tests-clar/diff


Log

Author Commit Date CI Message
yorah 519072c9 2013-06-14T14:02:00 diff: fix warning
Vicent Martí 88c401be 2013-06-12T14:54:32 Merge pull request #1643 from ethomson/rename_source Keep data about source of similarity
Russell Belfer f9c824c5 2013-06-12T11:55:27 Add patch from blobs API This adds two new public APIs: git_diff_patch_from_blobs and git_diff_patch_from_blob_and_buffer, plus it refactors the code for git_diff_blobs and git_diff_blob_to_buffer so that they code is almost entirely shared between these APIs, and adds tests for the new APIs.
Russell Belfer 54faddd2 2013-06-12T11:54:11 Fix some diff driver memory leaks
Russell Belfer 42e6cf78 2013-06-11T17:45:14 Add diff drivers tests (and fix bugs) This adds real tests for user-configured diff drivers and in the process found a bunch of bugs.
Russell Belfer 5dc98298 2013-06-11T11:22:22 Implement regex pattern diff driver This implements the loading of regular expression pattern lists for diff drivers that search for function context in that way. This also changes the way that diff drivers update options and interface with xdiff APIs to make them a little more flexible.
Edward Thomson bda3fbb1 2013-06-10T14:17:54 failing unit test for similar renames
Russell Belfer 114f5a6c 2013-06-10T10:10:39 Reorganize diff and add basic diff driver This is a significant reorganization of the diff code to break it into a set of more clearly distinct files and to document the new organization. Hopefully this will make the diff code easier to understand and to extend. This adds a new `git_diff_driver` object that looks of diff driver information from the attributes and the config so that things like function content in diff headers can be provided. The full driver spec is not implemented in the commit - this is focused on the reorganization of the code and putting the driver hooks in place. This also removes a few #includes from src/repository.h that were overbroad, but as a result required extra #includes in a variety of places since including src/repository.h no longer results in pulling in the whole world.
Russell Belfer cee695ae 2013-05-31T12:18:43 Make iterators use GIT_ITEROVER & smart advance 1. internal iterators now return GIT_ITEROVER when you go past the last item in the iteration. 2. git_iterator_advance will "advance" to the first item in the iteration if it is called immediately after creating the iterator, which allows a simpler idiom for basic iteration. 3. if git_iterator_advance encounters an error reading data (e.g. a missing tree or an unreadable file), it returns the error but also attempts to advance past the invalid data to prevent an infinite loop. Updated all tests and internal usage of iterators to account for these new behaviors.
Russell Belfer 49f70f2c 2013-05-23T15:48:06 Fill out diff rename test coverage This extends the rename tests to make sure that every rename scenario in the inner loop of git_diff_find_similar is actually exercised. Also, fixes an incorrect assert that was in one of the clauses that was not previously being exercised.
Russell Belfer 67db583d 2013-05-23T15:06:07 More diff rename tests; better split swap handling This adds a couple more tests of different rename scenarios. Also, this fixes a problem with the case where you have two "split" deltas and the left half of one matches the right half of the other. That case was already being handled, but in the wrong order in a way that could result in bad output. Also, if the swap also happened to put the other two halves into the correct place (i.e. two files exchanged places with each other), then the second delta was left with the SPLIT flag set when it really should be cleared.
Russell Belfer a21cbb12 2013-05-22T10:37:12 Significant rename detection rewrite This flips rename detection around so instead of creating a forward mapping from deltas to possible rename targets, instead it creates a reverse mapping, looking at possible targets and trying to find a source that they could have been renamed or copied from. This is important because each output can only have a single source, but a given source could map to multiple outputs (in the form of COPIED records). Additionally, this makes a couple of tweaks to the public rename detection APIs, mostly renaming a couple of options that control the behavior to make more sense and to be more like core Git. I walked through the tests looking at the exact results and updated the expectations based on what I saw. The new code is different from the old because it cannot give some nonsense results (like A was renamed to both B and C) which were part of the outputs previously.
Russell Belfer 4742148d 2013-05-20T13:41:39 Add more diff rename detection tests This adds a bunch more rename detection tests including checks vs the working directory, the new exact match options, some more whitespace variants, etc. This also adds a git_futils_writebuffer helper function and uses it in checkout. This is mainly added because I wanted an easy way to write out a git_buf to disk inside my test code.
Russell Belfer d958e37a 2013-05-17T17:21:45 Fix issues with git_diff_find_similar There are a number of bugs in the rename code that only were obvious when I started testing it against large old repos with more complex patterns. (The code to do that testing is not ready to merge with libgit2, but I do plan to add more thorough tests.) This contains a significant number of changes and also tweaks the public API slightly to make emulating core git easier. Most notably, this separates the GIT_DIFF_FIND_AND_BREAK_REWRITES flag into FIND_REWRITES (which adds a self-similarity score to every modified file) and BREAK_REWRITES (which splits the modified deltas into add/remove pairs in the diff list). When you do a raw output of core git, rewrites show up as M090 or such, not at A and D output, so I wanted to be able to emulate that. Publicly, this also changes the flags to be uint16_t since we don't need values out of that range. Internally, this contains significant changes from a number of small bug fixes (like using the wrong side of the diff to decide if the object could be found in the ODB vs the workdir) to larger issues about which files can and should be compared and how the various edge cases of similarity scores should be treated. Honestly, I don't think this is the last update that will have to be made to this code, but I think this moves us closer to correct behavior and I tried to document the code so it would be easier to follow..
Russell Belfer 79ef3be4 2013-05-15T14:50:05 Fix diff crash when last item is untracked dir When the last item in a diff was an untracked directory that only contained ignored items, the loop to scan the contents would run off the end of the iterator and dereference a NULL pointer. This includes a test that reproduces the problem and a fix.
nulltoken b4d33e46 2013-05-14T21:54:26 Fix some memory leaks
Russell Belfer e9ba61f3 2013-05-10T09:32:42 Fix diff output for renames and copies If you use rename detection, the renamed and copied files would not show any text diffs because the function that decides if data should be loaded didn't know which sides of the diff to load for those cases. This adds a test that looks at the patch generated for diff entries that are COPIED or RENAMED.
Russell Belfer c2f602f8 2013-05-07T07:15:39 Fix line numbering for patches with eofnl When a patch contained an eofnl change (i.e. the last line either gained or lost a newline), the oldno and newno line number values for the lines in the last hunk of the patch were not useful. This makes them behave in a more expected manner.
Russell Belfer fd96f98e 2013-05-07T04:36:42 More tests for files with no newline at end
Russell Belfer e35e2684 2013-05-07T04:32:17 Add GIT_DIFF_LINE_CONTEXT_EOFNL This adds a new line origin constant for the special line that is used when both files end without a newline. In the course of writing the tests for this, I was having problems with modifying a file but not having diff notice because it was the same size and modified less than one second from the start of the test, so I decided to start working on nanosecond timestamp support. This commit doesn't contain the nanosecond support, but it contains the reorganization of maybe_modified and the hooks so that if the nanosecond data were being read by stat() (or rather being copied by git_index_entry__init_from_stat), then the nsec would be taken into account. This new stuff could probably use some more tests, although there is some amount of it here.
Russell Belfer a66c4bc8 2013-04-29T02:57:01 More tests for diff untracked directories This includes more tests for various scenarios when diff includes an untracked directory in the workdir with contents either ignored or not.
Russell Belfer b1ff7004 2013-04-22T16:25:57 Improve diff config options handling 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.
Vicent Marti 8842c75f 2013-04-03T22:30:07 What has science done.
Russell Belfer 1384b688 2013-04-19T13:00:12 Move some low-level repo fns to include/git2/sys
yorah 0d32f39e 2013-03-04T11:31:50 Notify '*' pathspec correctly when diffing I also moved all tests related to notifying in their own file.
Russell Belfer ad26434b 2013-04-09T14:52:32 Tests and more fixes for submodule diffs This adds tests for diffs with submodules in them and (perhaps unsurprisingly) requires further fixes to be made. Specifically, this fixes: - when considering if a submodule is dirty in the workdir, it was being treated as dirty even if only the index was dirty. - git_diff_patch_to_str (and git_diff_patch_print) were "printing" the headers for files (and submodules) that were unmodified or had no meaningful content. - added comment to previous fix and removed unneeded parens.
Russell Belfer ccfa6805 2013-03-25T23:58:40 Fix some diff ignores and submodule dirty workdir This started out trying to look at the problems from issue #1425 and gradually grew to a broader set of fixes. There are two core things fixed here: 1. When you had an ignore like "/bin" which is rooted at the top of your tree, instead of immediately adding the "bin/" entry as an ignored item in the diff, we were returning all of the direct descendants of the directory as ignored items. This changes things to immediately ignore the directory. Note that this effects the behavior in test_status_ignore__subdirectories so that we no longer exactly match core gits ignore behavior, but the new behavior probably makes more sense (i.e. we now will include an ignored directory inside an untracked directory that we previously would have left off). 2. When a submodule only contained working directory changes, the diff code was always considering it unmodified which was just an outright bug. The HEAD SHA of the submodule matches the SHA in the parent repo index, and since the SHAs matches, the diff code was overwriting the actual status with UNMODIFIED. These fixes broke existing tests test_diff_workdir__submodules and test_status_ignore__subdirectories but looking it over, I actually think the new results are correct and the old results were wrong. @nulltoken had actually commented on the subdirectory ignore issue previously. I also included in the tests some debugging versions of the shared iteration callback routines that print status or diff information. These aren't used actively in the tests, but can be quickly swapped in to test code to give a better picture of what is being scanned in some of the complex test scenarios.
Russell Belfer 1098cfae 2013-03-22T14:52:29 Test fixes and cleanup 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).
Sven Strickroth b8acb775 2013-03-07T22:15:40 Added some tests for issue #1397 Signed-off-by: Sven Strickroth <email@cs-ware.de>
Russell Belfer 1323c6d1 2013-03-22T14:27:56 Add cl_repo_set_bool and cleanup tests This adds a helper function for the cases where you want to quickly set a single boolean config value for a repository. This allowed me to remove a lot of code.
Russell Belfer 65025cb8 2013-03-18T17:24:13 Three submodule status bug fixes 1. Fix sort order problem with submodules where "mod" was sorting after "mod-plus" because they were being sorted as "mod/" and "mod-plus/". This involved pushing the "contains a .git entry" test significantly lower in the stack. 2. Reinstate behavior that a directory which contains a .git entry will be treated as a submodule during iteration even if it is not yet added to the .gitmodules. 3. Now that any directory containing .git is reported as submodule, we have to be more careful checking for GIT_EEXISTS when we do a submodule lookup, because that is the error code that is returned by git_submodule_lookup when you try to look up a directory containing .git that has no record in gitmodules or the index.
Vicent Martí 1ac10aae 2013-03-12T09:23:53 Merge pull request #1408 from arrbee/refactor-iterators Refactor iterators
Edward Thomson aa408cbf 2013-03-11T11:18:00 handle small files in similarity metrics
Carlos Martín Nieto 1aa5318a 2013-03-09T16:04:34 diff: allow asking for diffs with no context 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.
Russell Belfer 9bea03ce 2013-03-06T15:16:34 Add INCLUDE_TREES, DONT_AUTOEXPAND iterator flags This standardizes iterator behavior across all three iterators (index, tree, and working directory). Previously the working directory iterator behaved differently from the other two. Each iterator can now operate in one of three modes: 1. *No tree results, auto expand trees* means that only non- tree items will be returned and when a tree/directory is encountered, we will automatically descend into it. 2. *Tree results, auto expand trees* means that results will be given for every item found, including trees, but you only need to call normal git_iterator_advance to yield every item (i.e. trees returned with pre-order iteration). 3. *Tree results, no auto expand* means that calling the normal git_iterator_advance when looking at a tree will not descend into the tree, but will skip over it to the next entry in the parent. Previously, behavior 1 was the only option for index and tree iterators, and behavior 3 was the only option for workdir. The main public API implications of this are that the `git_iterator_advance_into()` call is now valid for all iterators, not just working directory iterators, and all the existing uses of working directory iterators explicitly use the GIT_ITERATOR_DONT_AUTOEXPAND (for now). Interestingly, the majority of the implementation was in the index iterator, since there are no tree entries there and now have to fake them. The tree and working directory iterators only required small modifications.
Russell Belfer 169dc616 2013-03-05T16:10:05 Make iterator APIs consistent with standards The iterator APIs are not currently consistent with the parameter ordering of the rest of the codebase. This rearranges the order of parameters, simplifies the naming of a number of functions, and makes somewhat better use of macros internally to clean up the iterator code. This also expands the test coverage of iterator functionality, making sure that case sensitive range-limited iteration works correctly.
Carlos Martín Nieto 323bb885 2013-03-04T00:21:56 Fix a few leaks `git_diff_get_patch()` would unconditionally load the patch object and then simply leak it if the user hadn't requested it. Short-circuit loading the object if the user doesn't want it. The rest of the plugs are simply calling the free functions of objects allocated during the tests.
Russell Belfer 487fc724 2013-03-01T13:41:53 Allow empty config object and use it This removes assertions that prevent us from having an empty git_config object and then updates some tests that were dependent on global config state to use an empty config before running anything.
Russell Belfer 7d46b34b 2013-03-01T12:26:05 Control for core.autocrlf during testing
Vicent Martí e68e33f3 2013-02-27T14:50:32 Merge pull request #1233 from arrbee/file-similarity-metric Add file similarity scoring to diff rename/copy detection
Russell Belfer 1be4ba98 2013-02-22T11:13:01 More rename detection tests This includes tests for crlf changes, whitespace changes with the default comparison and with the ignore whitespace comparison, and more sensitivity checking for the comparison code.
Philip Kelley 7beeb3f4 2013-02-22T14:03:44 Rename 'exp' so it doesn't conflict with exp()
Russell Belfer 6f9d5ce8 2013-02-22T10:17:08 Fix tests for find_similar and related This fixes both a test that I broke in diff::patch where I was relying on the current state of the working directory for the renames test data and fixes an unstable test in diff::rename where the environment setting for the "diff.renames" config was being allowed to influence the test results.
Russell Belfer d4b747c1 2013-02-21T16:44:44 Add diff rename tests with partial similarity This adds some new tests that actually exercise the similarity metric between files to detect renames, copies, and split modified files that are too heavily modified. There is still more testing to do - these tests are just partially covering the cases. There is also one bug fix in this where a change set with only MODIFY being broken into ADD/DELETE (due to low self-similarity) without any additional RENAMED entries would end up not processing the split requests (because the num_rewrites counter got reset).
Russell Belfer 960a04dd 2013-02-21T12:40:33 Initial integration of similarity metric to diff This is the initial integration of the similarity metric into the `git_diff_find_similar()` code path. The existing tests all pass, but the new functionality isn't currently well tested. The integration does go through the pluggable metric interface, so it should be possible to drop in an alternative to the internal metric that libgit2 implements. This comes along with a behavior change for an existing interface; namely, passing two NULLs to git_diff_blobs (or passing NULLs to git_diff_blob_to_buffer) will now call the file_cb parameter zero times instead of one time. I know it's strange that that change is paired with this other change, but it emerged from some initialization changes that I ended up making.
Russell Belfer 71a3d27e 2013-02-08T10:06:47 Replace diff delta binary with flags Previously the git_diff_delta recorded if the delta was binary. This replaces that (with no net change in structure size) with a full set of flags. The flag values that were already in use for individual git_diff_file objects are reused for the delta flags, too (along with renaming those flags to make it clear that they are used more generally). This (a) makes things somewhat more consistent (because I was using a -1 value in the "boolean" binary field to indicate unset, whereas now I can just use the flags that are easier to understand), and (b) will make it easier for me to add some additional flags to the delta object in the future, such as marking the results of a copy/rename detection or other deltas that might want a special indicator. While making this change, I officially moved some of the flags that were internal only into the private diff header. This also allowed me to remove a gross hack in rename/copy detect code where I was overwriting the status field with an internal value.
Vicent Martí fcd7733d 2013-02-14T12:49:46 Merge pull request #1318 from nulltoken/topic/diff-tree-coverage Topic/diff tree coverage
Russell Belfer c2c0874d 2013-02-11T14:44:56 More diff tests with binary data
Russell Belfer 390a3c81 2013-02-11T11:44:00 Merge pull request #1190 from nulltoken/topic/reset-paths reset: Allow the selective reset of pathspecs
yorah 0d64ba48 2013-01-25T17:35:46 diff: add a notify callback to `git_diff__from_iterators` The callback will be called for each file, just before the `git_delta_t` gets inserted into the diff list. When the callback: - returns < 0, the diff process will be aborted - returns > 0, the delta will not be inserted into the diff list, but the diff process continues - returns 0, the delta is inserted into the diff list, and the diff process continues
nulltoken e8993455 2012-08-15T20:08:09 diff: Enhance tree-to-tree diff test coverage These tests are related to issue libgit2/libgit2sharp#196
nulltoken 7e858045 2013-02-06T16:06:17 diff: refactor git_diff_tree_to_tree() tests
nulltoken 3ad05221 2013-02-05T16:52:56 Fix MSVC compilation warnings Fix #1308
Russell Belfer 3bf68be4 2013-01-30T11:25:20 Free buffer at end of test
Russell Belfer f1e2735c 2013-01-30T11:10:39 Add helper for diff line stats This adds a `git_diff_patch_line_stats()` API that gets the total number of adds, deletes, and context lines in a patch. This will make it a little easier to emulate `git diff --stat` and the like. Right now, this relies on generating the `git_diff_patch` object, which is a pretty heavyweight way to get stat information. At some future point, it would probably be nice to be able to get this information without allocating the entire `git_diff_patch`, but that's a much larger project.
Russell Belfer cce548e3 2013-01-22T15:28:25 Fix case sensitivity bug with tree iterators With the new code to make tree iterators support ignore_case, there is a bug in setting the start entry for range bounded iterators where memcmp was being used instead of strncasecmp. This fixes that and expands the tree iterator test to cover the cases that were broken.
Russell Belfer 25423d03 2013-01-09T16:07:54 Support case insensitive tree iterators and status This makes tree iterators directly support case insensitivity by using a secondary index that can be sorted by icase. Also, this fixes the ambiguity check in the git_status_file API to also be case insensitive. Lastly, this adds new test cases for case insensitive range boundary checking for all types of iterators. With this change, it should be possible to deprecate the spool and sort iterator, but I haven't done that yet.
Russell Belfer a49340c3 2013-01-08T15:56:11 Test for ignore_case ranges on workdir iterator This adds a test that confirms that the working directory iterator can actually correctly process ranges of files case insensitively with proper sorting and proper boundaries.
Russell Belfer 134d8c91 2013-01-08T15:53:13 Update iterator API with flags for ignore_case This changes the iterator API so that flags can be passed in to the constructor functions to control the ignore_case behavior. At this point, the flags are not supported on tree iterators (i.e. there is no functional change over the old API), but the API changes are all made to accomodate this. By the way, I went with a flags parameter because in the future I have a couple of other ideas for iterator flags that will make it easier to fix some diff/status/checkout bugs.
Russell Belfer 4b181037 2013-01-08T13:39:15 Minor iterator API cleanups In preparation for further iterator changes, this cleans up a few small things in the iterator API: * removed the git_iterator_for_repo_index_range API * made git_iterator_free not be inlined * minor param name and test function name tweaks
Russell Belfer 805c476c 2013-01-11T11:20:44 Fix diff patch line number calculation This was just wrong. Added a test that verifying patch line numbers even for hunks further into a file and then fixed the algorithm. I needed to add a little extra state into the patch so that I could track old and new file numbers independently, but it should be okay.
Carlos Martín Nieto 2086e1ba 2013-01-11T16:54:57 tests: plug a couple of leaks
Russell Belfer de590550 2013-01-08T17:11:11 Resolve crash with diff against empty file It is not legal inside our `p_mmap` function to mmap a zero length file. This adds a test that exercises that case inside diff and fixes the code path where we would try to do that. The fix turns out not to be a lot of code since our default file content is already initialized to "" which works in this case. Fixes #1210
Russell Belfer f2b7f7a6 2013-01-07T15:44:22 Share git_diff_blobs/git_diff_blob_to_buffer code This moves the implementation of these two APIs into common code that will be shared between the two. Also, this adds tests for the `git_diff_blob_to_buffer` API. Lastly, this adds some extra `const` to a few places that can use it.
Sascha Cunz d5cf4665 2012-12-19T08:04:31 Fix some leaks and (possibly) dangling pointers in tests Also adds some asserts.
Vicent Martí e62171e2 2012-12-17T11:10:25 Merge pull request #1151 from arrbee/fix-diff-constructor-names Fix diff constructor names
Russell Belfer 56c72b75 2012-12-17T11:00:53 Fix diff constructor name order confusion The diff constructor functions had some confusing names, where the "old" side of the diff was coming after the "new" side. This reverses the order in the function name to make it less confusing. Specifically... * git_diff_index_to_tree becomes git_diff_tree_to_index * git_diff_workdir_to_index becomes git_diff_index_to_workdir * git_diff_workdir_to_tree becomes git_diff_tree_to_workdir
nulltoken a3337f10 2012-12-17T15:15:20 blob: introduce git_blob_is_binary()
Russell Belfer 91e7d263 2012-12-10T15:29:44 Fix iterator reset and add reset ranges The `git_iterator_reset` command has not been working in all cases particularly when there is a start and end range. This fixes it and adds tests for it, and also extends it with the ability to update the start/end range strings when an iterator is reset.
Russell Belfer 9950d27a 2012-12-06T13:26:58 Clean up iterator APIs This removes the need to explicitly pass the repo into iterators where the repo is implied by the other parameters. This moves the repo to be owned by the parent struct. Also, this has some iterator related updates to the internal diff API to lay the groundwork for checkout improvements.
Ben Straub 0ab3a2ab 2012-11-30T20:34:50 Deploy GIT_INIT_STRUCTURE
Ben Straub ca901e7b 2012-11-29T15:16:19 Deploy GIT_DIFF_FIND_OPTIONS_INIT
Ben Straub 2f8d30be 2012-11-29T15:05:04 Deploy GIT_DIFF_OPTIONS_INIT
Vicent Martí e2934db2 2012-11-29T02:05:46 Merge pull request #1090 from arrbee/ignore-invalid-by-default Ignore invalid entries by default
nulltoken 59a0d772 2012-11-27T20:24:56 diff: enhance test coverage against the workdir
Russell Belfer a8122b5d 2012-11-21T15:39:03 Fix warnings on Win64 build
Russell Belfer 793c4385 2012-11-20T16:36:06 Update diff callback param order 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.
Vicent Marti cfbe4be3 2012-11-17T19:54:47 More external API cleanup Conflicts: src/branch.c tests-clar/refs/branches/create.c
Sascha Cunz 9094d30b 2012-11-23T11:41:56 Reset all static variables to NULL in clar's __cleanup Without this change, any failed assertion in the second (or a later) test inside a test suite has a chance of double deleting memory, resulting in a heap corruption. See #1096 for details. This leaves alone the test cases where we "just" use cl_git_sandbox_init() and cl_git_sandbox_cleanup(). These methods already take good care to not double delete a repository. Fixes #1096
Russell Belfer d46b0a04 2012-11-19T16:34:44 Improve iterator ignoring .git file The workdir iterator has always tried to ignore .git files, but it turns out there were some bugs. This makes it more robust at ignoring .git files. This also makes iterators always check ".git" case insensitively regardless of the properties of the system. This will make libgit2 skip ".GIT" and the like. This is different from core git, but on systems with case insensitive but case preserving file systems, allowing ".GIT" to be added is problematic.
Russell Belfer bbe6dbec 2012-11-14T23:29:48 Add explicit git_index ptr to diff and checkout A number of diff APIs and the `git_checkout_index` API take a `git_repository` object an operate on the index. This updates them to take a `git_index` pointer explicitly and only fall back on the `git_repository` index if the index input is NULL. This makes it easier to operate on a temporary index.
Russell Belfer bad68c0a 2012-11-13T14:02:59 Add iterator for git_index object The index iterator could previously only be created from a repo object, but this allows creating an iterator from a `git_index` object instead (while keeping, though renaming, the old function).
Russell Belfer 5735bf5e 2012-11-13T13:58:29 Fix diff API to better parameter order The diff API is not in the parameter order one would expect from other libgit2 APIs. This fixes that.
Vicent Martí 1362a983 2012-11-02T10:00:28 Merge pull request #1014 from arrbee/diff-rename-detection Initial implementation of diff rename detection
Russell Belfer db106d01 2012-10-30T09:40:50 Move rename detection into new file This improves the naming for the rename related functionality moving it to be called `git_diff_find_similar()` and renaming all the associated constants, etc. to make more sense. I also moved the new code (plus the existing `git_diff_merge`) into a new file `diff_tform.c` where I can put new functions related to manipulating git diff lists. This also updates the implementation significantly from the last revision fixing some ordering issues (where break-rewrite needs to be handled prior to copy and rename detection) and improving config option handling.
Russell Belfer 93cf7bb8 2012-10-24T20:56:32 Add git_diff_patch_to_str API This adds an API to generate a complete single-file patch text from a git_diff_patch object.
Russell Belfer b4f5bb07 2012-10-23T16:40:51 Initial implementation of diff rename detection 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.
nulltoken c2e43fb1 2012-10-18T16:50:55 diff: workdir diffing in a bare repo returns EBAREREPO
Russell Belfer 4c47a8bc 2012-10-17T14:14:51 Merge pull request #968 from arrbee/diff-support-typechange Support TYPECHANGE records in status and adjust checkout accordingly
Russell Belfer 52032ae5 2012-10-15T12:48:43 Fix single-file ignore checks To answer if a single given file should be ignored, the path to that file has to be processed progressively checking that there are no intermediate ignored directories in getting to the file in question. This enables that, fixing the broken old behavior, and adds tests to exercise various ignore situations.
Russell Belfer 0d64bef9 2012-10-05T15:56:57 Add complex checkout test and then fix checkout This started as a complex new test for checkout going through the "typechanges" test repository, but that revealed numerous issues with checkout, including: * complete failure with submodules * failure to create blobs with exec bits * problems when replacing a tree with a blob because the tree "example/" sorts after the blob "example" so the delete was being processed after the single file blob was created This fixes most of those problems and includes a number of other minor changes that made it easier to do that, including improving the TYPECHANGE support in diff/status, etc.
Russell Belfer 5d1308f2 2012-10-08T15:19:00 Add test for diffs with submodules and bug fixes The adds a test for the submodule diff capabilities and then fixes a few bugs with how the output is generated. It improves the accuracy of OIDs in the diff delta object and makes the submodule output more closely mirror the OIDs that will be used by core git.
Russell Belfer 71966e2f 2012-10-08T15:18:30 Extend diff helpers for tests a little
Russell Belfer cc5bf359 2012-09-28T09:08:09 Clean up Win64 warnings
Russell Belfer bae957b9 2012-09-25T16:31:46 Add const to all shared pointers in diff API 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!
Russell Belfer 64286308 2012-09-25T10:48:50 Fix bugs in new diff patch code This fixes all the bugs in the new diff patch code. The only really interesting one is that when we merge two diffs, we now have to actually exclude diff delta records that are not supposed to be tracked, as opposed to before where they could be included because they would be skipped silently by `git_diff_foreach()`. Other than that, there are just minor errors.
Russell Belfer 5f69a31f 2012-09-24T20:52:34 Initial implementation of new diff patch API 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.
Russell Belfer 49d34c1c 2012-09-13T13:17:38 Fix problems in diff iterator record chaining 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.
Russell Belfer 1f35e89d 2012-09-11T12:03:33 Fix diff binary file detection In the process of adding tests for the max file size threshold (which treats files over a certain size as binary) there seem to be a number of problems in the new code with detecting binaries. This should fix those up, as well as add a test for the file size threshold stuff. Also, this un-deprecates `GIT_DIFF_LINE_ADD_EOFNL`, since I finally found a legitimate situation where it would be returned.
Russell Belfer b36effa2 2012-09-10T09:59:14 Replace git_diff_iterator_num_files with progress The `git_diff_iterator_num_files` API was problematic, since we don't actually know the exact number of files to be iterated over until we load those files into memory. This replaces it with a new `git_diff_iterator_progress` API that goes from 0 to 1, and moves and renamed the old API for the internal places that can tolerate a max value instead of an exact value.