summaryrefslogtreecommitdiff
path: root/tests-clar/diff/tree.c
Commit message (Collapse)AuthorAgeFilesLines
* Rename tests-clar to testsBen Straub2013-11-141-526/+0
|
* Add git_diff_options_init helperRussell Belfer2013-11-011-4/+3
| | | | | | | | | Sometimes the static initializer for git_diff_options cannot be used and since setting them to all zeroes doesn't actually work quite right, this adds a new helper for that situation. This also adds an explicit new value to the submodule settings options to be used when those enums need static initialization.
* Create git_diff_line and extend git_diff_hunkRussell Belfer2013-10-211-12/+7
| | | | | | | | | | | | | Instead of having functions with so very many parameters to pass hunk and line data, this takes the existing git_diff_hunk struct and extends it with more hunk data, plus adds a git_diff_line. Those structs are used to pass back hunk and line data instead of the old APIs that took tons of parameters. Some work that was previously only being done for git_diff_patch creation (scanning the diff content for exact line counts) is now done for all callbacks, but the performance difference should not be noticable.
* Diff API cleanupRussell Belfer2013-10-151-13/+15
| | | | | | | | This lays groundwork for separating formatting options from diff creation options. This groups the formatting flags separately from the diff list creation flags and reorders the options. This also tweaks some APIs to further separate code that uses patches from code that just looks at git_diffs.
* Rename diff objects and split patch.hRussell Belfer2013-10-111-19/+19
| | | | | | This makes no functional change to diff but renames a couple of the objects and splits the new git_patch (formerly git_diff_patch) into a new header file.
* Improve diff config options handlingRussell Belfer2013-04-231-0/+74
| | | | | | | | | | | | | | This makes diff use the cvar cache for config options where possible, and also adds support for a number of other config options to diff including "diff.context", "diff.ignoreSubmodules", "diff.noprefix", "diff.mnemonicprefix", and "core.abbrev". To make this natural, this involved a rearrangement of the code that allocates the diff object vs. the code that initializes it based on the combination of options passed in by the user and read from the config. This commit includes tests for most of these new options as well.
* Test fixes and cleanupRussell Belfer2013-03-251-5/+3
| | | | | | | | This fixes some places where the new tests were leaving the test area in a bad state or were freeing data they should not free. It also removes code that is extraneous to the core issue and fixes an invalid SHA being looked up in one of the tests (which was failing, but for the wrong reason).
* Added some tests for issue #1397Sven Strickroth2013-03-251-0/+25
| | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* diff: allow asking for diffs with no contextCarlos Martín Nieto2013-03-091-0/+2
| | | | | | | | | Previously, 0 meant default. This is problematic, as asking for 0 context lines is a valid thing to do. Change GIT_DIFF_OPTIONS_INIT to default to three and stop treating 0 as a magic value. In case no options are provided, make sure the options in the diff object default to 3.
* Rename 'exp' so it doesn't conflict with exp()Philip Kelley2013-02-221-59/+59
|
* diff: Enhance tree-to-tree diff test coveragenulltoken2013-02-061-0/+109
| | | | These tests are related to issue libgit2/libgit2sharp#196
* diff: refactor git_diff_tree_to_tree() testsnulltoken2013-02-061-45/+18
|
* Deploy GIT_DIFF_OPTIONS_INITBen Straub2012-11-301-3/+31
|
* Update diff callback param orderRussell Belfer2012-11-271-5/+5
| | | | | | | | This makes the diff functions that take callbacks both take the payload parameter after the callback function pointers and pass the payload as the last argument to the callback function instead of the first. This should make them consistent with other callbacks across the API.
* More external API cleanupVicent Marti2012-11-271-14/+16
| | | | | | Conflicts: src/branch.c tests-clar/refs/branches/create.c
* Fix diff API to better parameter orderRussell Belfer2012-11-141-8/+8
| | | | | The diff API is not in the parameter order one would expect from other libgit2 APIs. This fixes that.
* Initial implementation of diff rename detectionRussell Belfer2012-10-231-25/+25
| | | | | | | | | | | | | | | | This implements the basis for diff rename and copy detection, although it is based on simple SHA comparison right now instead of using a matching algortihm. Just as `git_diff_merge` can be used as a post-pass on diffs to emulate certain command line behaviors, there is a new API `git_diff_detect` which will update a diff list in-place, adjusting some deltas to RENAMED or COPIED state (and also, eventually, splitting MODIFIED deltas where the change is too large into DELETED/ADDED pairs). This also adds a new test repo that will hold rename/copy/split scenarios. Right now, it just has exact-match rename and copy, but the tests are written to use tree diffs, so we should be able to add new test scenarios easily without breaking tests.
* Extend diff helpers for tests a littleRussell Belfer2012-10-081-9/+9
|
* Clean up Win64 warningsRussell Belfer2012-09-281-1/+1
|
* Add const to all shared pointers in diff APIRussell Belfer2012-09-251-2/+2
| | | | | | | | | | There are a lot of places where the diff API gives the user access to internal data structures and many of these were being exposed through non-const pointers. This replaces them all with const pointers for any object that the user can access but is still owned internally to the git_diff_list or git_diff_patch objects. This will probably break some bindings... Sorry!
* Initial implementation of new diff patch APIRussell Belfer2012-09-251-48/+27
| | | | | | | | Replacing the `git_iterator` object, this creates a simple API for accessing the "patch" for any file pair in a diff list and then gives indexed access to the hunks in the patch and the lines in the hunk. This is the initial implementation of this revised API - it is still broken, but at least builds cleanly.
* Fix problems in diff iterator record chainingRussell Belfer2012-09-131-0/+82
| | | | | | | There is a bug in building the linked list of line records in the diff iterator and also an off by one element error in the hunk counts. This fixes both of these, adds some test data with more complex sets of hunk and line diffs to exercise this code better.
* Diff iteratorsRussell Belfer2012-09-051-36/+36
| | | | | | | | | | | This refactors the diff output code so that an iterator object can be used to traverse and generate the diffs, instead of just the `foreach()` style with callbacks. The code has been rearranged so that the two styles can still share most functions. This also replaces `GIT_REVWALKOVER` with `GIT_ITEROVER` and uses that as a common error code for marking the end of iteration when using a iterator style of object.
* Fix bug with merging diffs with null optionsRussell Belfer2012-07-191-0/+48
| | | | | | | A diff that is created with a NULL options parameter could result in a NULL prefix string, but diff merge was unconditionally strdup'ing it. I added a test to replicate the issue and then a new method that does the right thing with NULL values.
* Minor fixes, cleanups, and clarificationsRussell Belfer2012-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | There are three actual changes in this commit: 1. When the trailing newline of a file is removed in a diff, the change will now be reported with `GIT_DIFF_LINE_DEL_EOFNL` passed to the callback. Previously, the `ADD_EOFNL` constant was given which was just an error in my understanding of when the various circumstances arose. `GIT_DIFF_LINE_ADD_EOFNL` is deprecated and should never be generated. A new newline is simply an `ADD`. 2. Rewrote the `diff_delta__merge_like_cgit` function that contains the core logic of the `git_diff_merge` implementation. The new version doesn't actually have significantly different behavior, but the logic should be much more obvious, I think. 3. Fixed a bug in `git_diff_merge` where it freed a string pool while some of the string data was still in use. This led to `git_diff_print_patch` accessing memory that had been freed. The rest of this commit contains improved documentation in `diff.h` to make the behavior and the equivalencies with core git clearer, and a bunch of new tests to cover the various cases, oh and a minor simplification of `examples/diff.c`.
* diff: fix the diffing of two identical blobsnulltoken2012-05-071-9/+9
|
* Fix memory leaks and use after freeRussell Belfer2012-05-041-0/+2
|
* Support reading attributes from indexRussell Belfer2012-05-031-14/+52
| | | | | | | | | | | | | | Depending on the operation, we need to consider gitattributes in both the work dir and the index. This adds a parameter to all of the gitattributes related functions that allows user control of attribute reading behavior (i.e. prefer workdir, prefer index, only use index). This fix also covers allowing us to check attributes (and hence do diff and status) on bare repositories. This was a somewhat larger change that I hoped because it had to change the cache key used for gitattributes files.
* Update clar and remove old helpersRussell Belfer2012-04-171-9/+9
| | | | | | This updates to the latest clar which includes the helpers `cl_assert_equal_s` and `cl_assert_equal_i`. Convert the code over to use those and remove the old libgit2-only helpers.
* Clean up GIT_UNUSED macros on all platformsRussell Belfer2012-03-021-7/+2
| | | | | | | | | | | | | | | | | | | It turns out that commit 31e9cfc4cbcaf1b38cdd3dbe3282a8f57e5366a5 did not fix the GIT_USUSED behavior on all platforms. This commit walks through and really cleans things up more thoroughly, getting rid of the unnecessary stuff. To remove the use of some GIT_UNUSED, I ended up adding a couple of new iterators for hashtables that allow you to iterator just over keys or just over values. In making this change, I found a bug in the clar tests (where we were doing *count++ but meant to do (*count)++ to increment the value). I fixed that but then found the test failing because it was not really using an empty repo. So, I took some of the code that I wrote for iterator testing and moved it to clar_helpers.c, then made use of that to make it easier to open fixtures on a per test basis even within a single test file.
* Update diff to use iteratorsRussell Belfer2012-03-021-22/+24
| | | | | | | | | | | | | This is a major reorganization of the diff code. This changes the diff functions to use the iterators for traversing the content. This allowed a lot of code to be simplified. Also, this moved the functions relating to outputting a diff into a new file (diff_output.c). This includes a number of other changes - adding utility functions, extending iterators, etc. plus more tests for the diff code. This also takes the example diff.c program much further in terms of emulating git-diff command line options.
* Add tests and fix bugs for diff whitespace optionsRussell Belfer2012-03-021-0/+87
| | | | | | Once I added tests for the whitespace handling options of diff, I realized that there were some bugs. This fixes those and adds the new tests into the test suite.
* Continue implementation of git-diffRussell Belfer2012-03-021-24/+5
| | | | | | | | * Implemented git_diff_index_to_tree * Reworked git_diff_options structure to handle more options * Made most of the options in git_diff_options actually work * Reorganized code a bit to remove some redundancy * Added option parsing to examples/diff.c to test most options
* Clean up diff implementation for reviewRussell Belfer2012-03-021-0/+105
This fixes several bugs, updates tests and docs, eliminates the FILE* assumption in favor of printing callbacks for the diff patch formatter helpers, and adds a "diff" example function that can perform a diff from the command line.