tests/diff


Log

Author Commit Date CI Message
Patrick Steinhardt e5090ee3 2018-10-04T11:19:28 diff_stats: use git's formatting of renames with common directories In cases where a file gets renamed such that the directories containing it previous and after the rename have a common prefix, then git will avoid printing this prefix twice and instead format the rename as "prefix/{old => new}". We currently didn't do anything like that, but simply printed "prefix/old -> prefix/new". Adjust our behaviour to instead match upstream. Adjust the test for this behaviour to expect the new format.
Patrick Steinhardt 3148efd2 2018-10-04T11:13:57 tests: verify diff stats with renames in subdirectory Until now, we didn't have any tests that verified that our format for renames in subdirectories is correct. While our current behaviour is no different than for renames that do not happen with a common prefix shared between old and new file name, we intend to change the format to instead match the format that upstream git uses. Add a test case for this to document our current behaviour and to show how the next commit will change that format.
Patrick Steinhardt 0652abaa 2018-07-20T12:56:49 Merge pull request #4702 from tiennou/fix/coverity Assorted Coverity fixes
Edward Thomson 6dfc8bc2 2018-07-09T23:10:05 Merge pull request #4719 from pks-t/pks/delta-oob Delta OOB access
Etienne Samson 8455a270 2018-07-01T12:04:27 tests: add missing cl_git_pass to tests Reported by Coverity, CID 1393678-1393697.
Patrick Steinhardt 7db25870 2018-06-29T07:45:18 delta: fix sign-extension of big left-shift Our delta code was originally adapted from JGit, which itself adapted it from git itself. Due to this heritage, we inherited a bug from git.git in how we compute the delta offset, which was fixed upstream in 48fb7deb5 (Fix big left-shifts of unsigned char, 2009-06-17). As explained by Linus: Shifting 'unsigned char' or 'unsigned short' left can result in sign extension errors, since the C integer promotion rules means that the unsigned char/short will get implicitly promoted to a signed 'int' due to the shift (or due to other operations). This normally doesn't matter, but if you shift things up sufficiently, it will now set the sign bit in 'int', and a subsequent cast to a bigger type (eg 'long' or 'unsigned long') will now sign-extend the value despite the original expression being unsigned. One example of this would be something like unsigned long size; unsigned char c; size += c << 24; where despite all the variables being unsigned, 'c << 24' ends up being a signed entity, and will get sign-extended when then doing the addition in an 'unsigned long' type. Since git uses 'unsigned char' pointers extensively, we actually have this bug in a couple of places. In our delta code, we inherited such a bogus shift when computing the offset at which the delta base is to be found. Due to the sign extension we can end up with an offset where all the bits are set. This can allow an arbitrary memory read, as the addition in `base_len < off + len` can now overflow if `off` has all its bits set. Fix the issue by casting the result of `*delta++ << 24UL` to an unsigned integer again. Add a test with a crafted delta that would actually succeed with an out-of-bounds read in case where the cast wouldn't exist. Reported-by: Riccardo Schirone <rschiron@redhat.com> Test-provided-by: Riccardo Schirone <rschiron@redhat.com>
Etienne Samson f9e28026 2018-06-18T20:37:18 patch_parse: populate line numbers while parsing diffs
Patrick Steinhardt ecf4f33a 2018-02-08T11:14:48 Convert usage of `git_buf_free` to new `git_buf_dispose`
Stan Hu 9d83a2b0 2018-02-22T22:55:50 Sanitize the hunk header to ensure it contains UTF-8 valid data The diff driver truncates the hunk header text to 80 bytes, which can truncate 4-byte Unicode characters and introduce garbage characters in the diff output. This change sanitizes the hunk header before it is displayed. This mirrors the test in git: https://github.com/git/git/blob/master/t/t4025-hunk-header.sh Closes https://github.com/libgit2/rugged/issues/716
Erik van Zijst cd6a4323 2018-04-04T21:29:03 typo: Fixed a trivial typo in test function.
Patrick Steinhardt ce7080a0 2018-02-20T10:38:27 diff_tform: fix rename detection with rewrite/delete pair A rewritten file can either be classified as a modification of its contents or of a delete of the complete file followed by an addition of the new content. This distinction becomes important when we want to detect renames for rewrites. Given a scenario where a file "a" has been deleted and another file "b" has been renamed to "a", this should be detected as a deletion of "a" followed by a rename of "a" -> "b". Thus, splitting of the original rewrite into a delete/add pair is important here. This splitting is represented by a flag we can set at the current delta. While the flag is already being set in case we want to break rewrites, we do not do so in case where the `GIT_DIFF_FIND_RENAMES_FROM_REWRITES` flag is set. This can trigger an assert when we try to match the source and target deltas. Fix the issue by setting the `GIT_DIFF_FLAG__TO_SPLIT` flag at the delta when it is a rename target and `GIT_DIFF_FIND_RENAMES_FROM_REWRITES` is set.
Patrick Steinhardt 80e77b87 2018-02-20T10:03:48 tests: add rename-rewrite scenarios to "renames" repository Add two more scenarios to the "renames" repository. The first scenario has a major rewrite of a file and a delete of another file, the second scenario has a deletion of a file and rename of another file to the deleted file. Both scenarios will be used in the following commit.
Patrick Steinhardt d91da1da 2018-02-20T09:54:58 tests: diff::rename: use defines for commit OIDs While we frequently reuse commit OIDs throughout the file, we do not have any constants to refer to these commits. Make this a bit easier to read by giving the commit OIDs somewhat descriptive names of what kind of commit they refer to.
Patrick Steinhardt 2388a9e2 2017-12-15T10:47:01 diff_file: properly refcount blobs when initializing file contents When initializing a `git_diff_file_content` from a source whose data is derived from a blob, we simply assign the blob's pointer to the resulting struct without incrementing its refcount. Thus, the structure can only be used as long as the blob is kept alive by the caller. Fix the issue by using `git_blob_dup` instead of a direct assignment. This function will increment the refcount of the blob without allocating new memory, so it does exactly what we want. As `git_diff_file_content__unload` already frees the blob when `GIT_DIFF_FLAG__FREE_BLOB` is set, we don't need to add new code handling the free but only have to set that flag correctly.
Patrick Steinhardt cc4c44a9 2017-09-01T09:37:05 patch_parse: fix parsing patches only containing exact renames Patches which contain exact renames only will not contain an actual diff body, but only a list of files that were renamed. Thus, the patch header is immediately followed by the terminating sequence "-- ". We currently do not recognize this character sequence as a possible terminating sequence. Add it and create a test to catch the failure.
Patrick Steinhardt 89a34828 2017-06-16T13:34:43 diff: implement function to calculate patch ID The upstream git project provides the ability to calculate a so-called patch ID. Quoting from git-patch-id(1): A "patch ID" is nothing but a sum of SHA-1 of the file diffs associated with a patch, with whitespace and line numbers ignored." Patch IDs can be used to identify two patches which are probably the same thing, e.g. when a patch has been cherry-picked to another branch. This commit implements a new function `git_diff_patchid`, which gets a patch and derives an OID from the diff. Note the different terminology here: a patch in libgit2 are the differences in a single file and a diff can contain multiple patches for different files. The implementation matches the upstream implementation and should derive the same OID for the same diff. In fact, some code has been directly derived from the upstream implementation. The upstream implementation has two different modes to calculate patch IDs, which is the stable and unstable mode. The old way of calculating the patch IDs was unstable in a sense that a different ordering the diffs was leading to different results. This oversight was fixed in git 1.9, but as git tries hard to never break existing workflows, the old and unstable way is still default. The newer and stable way does not care for ordering of the diff hunks, and in fact it is the mode that should probably be used today. So right now, we only implement the stable way of generating the patch ID.
Patrick Steinhardt c0eba379 2017-03-14T11:01:19 diff_parse: correctly set options for parsed diffs The function `diff_parsed_alloc` allocates and initializes a `git_diff_parsed` structure. This structure also contains diff options. While we initialize its flags, we fail to do a real initialization of its values. This bites us when we want to actually use the generated diff as we do not se the option's version field, which is required to operate correctly. Fix the issue by executing `git_diff_init_options` on the embedded struct.
Patrick Steinhardt ad5a909c 2017-03-14T09:39:37 patch_parse: fix parsing minimal trailing diff line In a diff, the shortest possible hunk with a modification (that is, no deletion) results from a file with only one line with a single character which is removed. Thus the following hunk @@ -1 +1 @@ -a + is the shortest valid hunk modifying a line. The function parsing the hunk body though assumes that there must always be at least 4 bytes present to make up a valid hunk, which is obviously wrong in this case. The absolute minimum number of bytes required for a modification is actually 2 bytes, that is the "+" and the following newline. Note: if there is no trailing newline, the assumption will not be offended as the diff will have a line "\ No trailing newline" at its end. This patch fixes the issue by lowering the amount of bytes required.
Patrick Steinhardt ace3508f 2017-03-14T10:37:47 patch_generate: fix `git_diff_foreach` only working with generated diffs The current logic of `git_diff_foreach` makes the assumption that all diffs passed in are actually derived from generated diffs. With these assumptions we try to derive the actual diff by inspecting either the working directory files or blobs of a repository. This obviously cannot work for diffs parsed from a file, where we do not necessarily have a repository at hand. Since the introduced split of parsed and generated patches, there are multiple functions which help us to handle patches generically, being indifferent from where they stem from. Use these functions and remove the old logic specific to generated patches. This allows re-using the same code for invoking the callbacks on the deltas.
Edward Thomson 610cff13 2016-10-09T16:05:48 Merge branch 'pr/3809'
Sim Domingo dc5cfdba 2016-06-02T23:18:31 make git_diff_stats_to_buf not show 0 insertions or 0 deletions
Edward Thomson b859faa6 2016-08-23T23:38:39 Teach `git_patch_from_diff` about parsed diffs Ensure that `git_patch_from_diff` can return the patch for parsed diffs, not just generate a patch for a generated diff.
Edward Thomson 1a79cd95 2016-04-26T01:18:01 patch: show copy information for identical copies When showing copy information because we are duplicating contents, for example, when performing a `diff --find-copies-harder -M100 -B100`, then show copy from/to lines in a patch, and do not show context. Ensure that we can also parse such patches.
Edward Thomson 9eb19381 2016-04-25T22:35:55 patch::parse: test diff with exact rename and copy
Edward Thomson 8a670dc4 2016-04-25T18:08:03 patch::parse: test diff with simple rename
Edward Thomson e774d5af 2016-04-25T16:47:48 diff::parse tests: test parsing a diff Test that we can create a diff file, then parse the results and that the two are identical in-memory.
Edward Thomson 7166bb16 2016-04-25T00:35:48 introduce `git_diff_from_buffer` to parse diffs Parse diff files into a `git_diff` structure.
Edward Thomson 9be638ec 2016-04-19T15:12:18 git_diff_generated: abstract generated diffs
Edward Thomson 2e0391f4 2016-04-02T11:33:00 diff: test submodules are found with trailing `/` Test that submodules are found when the are included in a pathspec but have a trailing slash.
Edward Thomson de034cd2 2016-03-18T10:59:38 iterator: give the tests a proper hierarchy Iterator tests were split over repo::iterator and diff::iterator, with duplication between the two. Move them to iterator::index, iterator::tree, and iterator::workdir.
Jeff Hostetler df25daef 2016-01-04T12:12:24 Added clar test for #3568
Edward Thomson be30387e 2016-02-25T16:05:18 iterators: refactored tree iterator Refactored the tree iterator to never recurse; simply process the next entry in order in `advance`. Additionally, reduce the number of allocations and sorting as much as possible to provide a ~30% speedup on case-sensitive iteration. (The gains for case-insensitive iteration are less majestic.)
Edward Thomson 684b35c4 2016-02-25T15:11:14 iterator: disambiguate reset and reset_range Disambiguate the reset and reset_range functions. Now reset_range with a NULL path will clear the start or end; reset will leave the existing start and end unchanged.
Carlos Martín Nieto 60a194aa 2016-03-20T11:00:12 tree: re-use the id and filename in the odb object Instead of copying over the data into the individual entries, point to the originals, which are already in a format we can use.
Carlos Martín Nieto e23efa6d 2016-03-03T21:03:10 tests: take the version from our define
Edward Thomson 4afe536b 2016-02-28T16:02:49 tests: use legitimate object ids Use legitimate (existing) object IDs in tests so that we have the ability to turn on strict object validation when running tests.
Carlos Martín Nieto 5663d4f6 2016-02-18T12:31:56 Merge pull request #3613 from ethomson/fixups Remove most of the silly warnings
Edward Thomson 35439f59 2016-02-11T12:24:21 win32: introduce p_timeval that isn't stupid Windows defines `timeval` with `long`, which we cannot sanely cope with. Instead, use a custom timeval struct.
Arthur Schreiber 3679ebae 2016-02-11T23:37:52 Horrible fix for #3173.
Patrick Steinhardt 254e0a33 2015-11-24T13:43:43 diff: include commit message when formatting patch When formatting a patch as email we do not include the commit's message in the formatted patch output. Implement this and add a test that verifies behavior.
Jacques Germishuys 87428c55 2015-11-20T20:48:51 Fix some warnings
Carlos Martín Nieto 1c34b717 2015-11-08T05:10:18 Merge pull request #3498 from ethomson/windows_symlinks Diff: Honor `core.symlinks=false` and fake symlinks
Edward Thomson f20480ab 2015-11-03T09:40:30 diff: test "symlinks" in wd are respected on win32 When `core.symlinks = false`, we write the symlinks content (target) to a regular file. We should ensure that when we later see that regular file, we treat it specially - and that changing that regular file would actually change the symlink target. (For compatibility with Git for Windows).
Jason Haslam 3138ad93 2015-07-16T10:17:16 Add diff progress callback.
Vicent Marti bbe1957b 2015-10-21T12:09:29 tests: Fix warnings
Guille -bisho- e4b2b919 2015-09-25T10:37:41 Fix binary diffs git expects an empty line after the binary data: literal X ...binary data... <empty_line> The last literal block of the generated patches were not containing the required empty line. Example: diff --git a/binary_file b/binary_file index 3f1b3f9098131cfecea4a50ff8afab349ea66d22..86e5c1008b5ce635d3e3fffa4434c5eccd8f00b6 100644 GIT binary patch literal 8 Pc${NM&PdElPvrst3ey5{ literal 6 Nc${NM%g@i}0ssZ|0lokL diff --git a/binary_file2 b/binary_file2 index 31be99be19470da4af5b28b21e27896a2f2f9ee2..86e5c1008b5ce635d3e3fffa4434c5eccd8f00b6 100644 GIT binary patch literal 8 Pc${NM&PdElPvrst3ey5{ literal 13 Sc${NMEKbZyOexL+Qd|HZV+4u- git apply of that diff results in: error: corrupt binary patch at line 9: diff --git a/binary_file2 b/binary_file2 fatal: patch with only garbage at line 10 The proper formating is: diff --git a/binary_file b/binary_file index 3f1b3f9098131cfecea4a50ff8afab349ea66d22..86e5c1008b5ce635d3e3fffa4434c5eccd8f00b6 100644 GIT binary patch literal 8 Pc${NM&PdElPvrst3ey5{ literal 6 Nc${NM%g@i}0ssZ|0lokL diff --git a/binary_file2 b/binary_file2 index 31be99be19470da4af5b28b21e27896a2f2f9ee2..86e5c1008b5ce635d3e3fffa4434c5eccd8f00b6 100644 GIT binary patch literal 8 Pc${NM&PdElPvrst3ey5{ literal 13 Sc${NMEKbZyOexL+Qd|HZV+4u-
Edward Thomson 92f7d32b 2015-09-12T13:46:22 diff::workdir: ensure ignored files are not returned Ensure that a diff with the workdir is not erroneously returning directories.
Edward Thomson d53c8880 2015-08-30T19:25:47 iterator: saner pathlist matching for idx iterator Some nicer refactoring for index iteration walks. The index iterator doesn't binary search through the pathlist space, since it lacks directory entries, and would have to binary search each index entry and all its parents (eg, when presented with an index entry of `foo/bar/file.c`, you would have to look in the pathlist for `foo/bar/file.c`, `foo/bar` and `foo`). Since the index entries and the pathlist are both nicely sorted, we walk the index entries in lockstep with the pathlist like we do for other iteration/diff/merge walks.
Edward Thomson 4a0dbeb0 2015-08-30T17:06:26 diff: use new iterator pathlist handling When using literal pathspecs in diff with `GIT_DIFF_DISABLE_PATHSPEC_MATCH` turn on the faster iterator pathlist handling. Updates iterator pathspecs to include directory prefixes (eg, `foo/`) for compatibility with `GIT_DIFF_DISABLE_PATHSPEC_MATCH`.
Edward Thomson 3273ab3f 2015-08-28T20:06:18 diff: better document GIT_DIFF_PATHSPEC_DISABLE Document that `GIT_DIFF_PATHSPEC_DISABLE` is not necessarily about explicit path matching, but also includes matching of directory names. Enforce this in a test.
Edward Thomson ed1c6446 2015-07-28T11:41:27 iterator: use an options struct instead of args
Carlos Martín Nieto e451cd5c 2015-08-15T18:46:38 diff: don't error out on an invalid regex When parsing user-provided regex patterns for functions, we must not fail to provide a diff just because a pattern is not well formed. Ignore it instead.
Pierre-Olivier Latour ccef5adb 2015-06-30T09:30:20 Added git_diff_index_to_index()
Carlos Martín Nieto fa399750 2015-06-27T21:26:27 Merge pull request #3265 from libgit2/leaks Plug a bunch of leaks
Carlos Martín Nieto 9568660f 2015-06-26T18:31:39 diff: fix leaks in diff printing
Carlos Martín Nieto cfafeb84 2015-06-26T18:11:05 Merge pull request #3263 from git-up/fixes Fixes
Pierre-Olivier Latour 492851c9 2015-06-26T08:18:06 Removed unused variables
Vicent Marti 13e5e344 2015-06-26T16:52:26 test-diff-blob: Pass proper nibble sizes
Edward Thomson 619423f2 2015-06-19T11:11:12 diff: test we don't update index unnecessarily Test that workdir diffs, when presented with UPDATE_INDEX, only write the index when they actually make a change.
Carlos Martín Nieto c2418f46 2015-06-25T12:48:44 Rename FALLBACK to UNSPECIFIED Fallback describes the mechanism, while unspecified explains what the user is thinking.
Carlos Martín Nieto daacf96d 2015-06-24T23:34:40 Merge pull request #3097 from libgit2/cmn/submodule-config-state Remove run-time configuration settings from submodules
Edward Thomson ba8fb7c4 2015-06-24T11:39:59 diff::binary tests: empty diff when forced binary Ensure that even when we're forcing a binary diff that we do not assume that there *is* a diff. There should be an empty diff for no change.
Carlos Martín Nieto 76633215 2015-06-24T14:25:36 binary diff: test that the diff and patch otputs are the same We test the generation of the textual patch via the patch function, which are just one of two possibilities to get the output. Add a second patch generation via the diff function to make sure both outputs are in sync.
Edward Thomson cc605e73 2015-06-23T23:52:03 Merge pull request #3222 from git-up/conflicted Fixed GIT_DELTA_CONFLICTED not returned in some cases
Edward Thomson bd670abd 2015-06-23T23:30:58 Merge pull request #3226 from libgit2/cmn/racy-diff-again racy-git, the missing link
Pierre-Olivier Latour 8d8a2eef 2015-06-15T11:14:40 Fixed GIT_DELTA_CONFLICTED not returned in some cases If an index entry for a file that is not in HEAD is in conflicted state, when diffing HEAD with the index, the status field of the corresponding git_diff_delta was incorrectly reported as GIT_DELTA_ADDED instead of GIT_DELTA_CONFLICTED. This was due to handle_unmatched_new_item() initially setting the status to GIT_DELTA_CONFLICTED but then overriding it later with GIT_DELTA_ADDED.
Pierre-Olivier Latour cb63e7e8 2015-06-17T08:55:09 Explicitly handle GIT_DELTA_CONFLICTED in git_diff_merge() This fixes a bug where if a file was in conflicted state in either diff, it would not always remain in conflicted state in the merged diff.
Carlos Martín Nieto c6f489c9 2015-05-04T17:29:12 submodule: add an ignore option to status This lets us specify in the status call which ignore rules we want to use (optionally falling back to whatever the submodule has in its configuration). This removes one of the reasons for having `_set_ignore()` set the value in-memory. We re-use the `IGNORE_RESET` value for this as it is no longer relevant but has a similar purpose to `IGNORE_FALLBACK`. Similarly, we remove `IGNORE_DEFAULT` which does not have use outside of initializers and move that to fall back to the configuration as well.
Carlos Martín Nieto 5a9fc6c8 2015-05-04T16:22:56 submodule: make set_ignore() affect the configuration Instead of affecting a particular instance, make it change the configuration.
Carlos Martín Nieto 27133caf 2015-06-20T17:20:07 tests: move racy tests to the index They fit there much better, even though we often check by diffing, it's about the behaviour of the index.
Carlos Martín Nieto 26432a9c 2015-06-20T12:37:32 tests: set racy times manually
Carlos Martín Nieto 6c5eaead 2015-06-20T12:36:58 tests: plug leaks in the racy test
Carlos Martín Nieto ff475375 2015-06-17T14:34:10 diff: check files with the same or newer timestamps When a file on the workdir has the same or a newer timestamp than the index, we need to perform a full check of the contents, as the update of the file may have happened just after we wrote the index. The iterator changes are such that we can reach inside the workdir iterator from the diff, though it may be better to have an accessor instead of moving these structs into the header.
Carlos Martín Nieto a56db992 2015-06-17T08:15:49 Merge pull request #3219 from libgit2/cmn/racy-diff Zero out racily-clean entries' file_size
Carlos Martín Nieto e44abe16 2015-06-16T08:51:45 tests: tick the index when we count OID calculations These tests want to test that we don't recalculate entries which match the index already. This is however something we force when truncating racily-clean entries. Tick the index forward as we know that we don't perform the modifications which the racily-clean code is trying to avoid.
Carlos Martín Nieto 77596fcf 2015-06-15T09:51:34 diff: add failing test for racy-git in the index We update the index and then immediately change the contents of the file. This makes the diff think there are no changes, as the timestamp of the file agrees with the cached data. This is however a bug, as the file has obviously changed contents. The test is a bit fragile, as it assumes that the index writing and the following modification of the file happen in the same second, but it's enough to show the issue.
Pierre-Olivier Latour 0f4d9c03 2015-06-15T09:52:40 Fixed Xcode 6.1 build warnings
Edward Thomson 391281ae 2015-06-02T18:26:22 binary diff: test binary blob to blob tests
Edward Thomson 8147b1af 2015-05-25T20:03:59 diff: introduce binary diff callbacks Introduce a new binary diff callback to provide the actual binary delta contents to callers. Create this data from the diff contents (instead of directly from the ODB) to support binary diffs including the workdir, not just things coming out of the ODB.
Edward Thomson ac7012a8 2015-05-25T20:36:29 binary diff: test index->workdir binary diffs
Pierre-Olivier Latour 9f3c18e2 2015-06-02T08:36:15 Fixed build warnings on Xcode 6.1
Edward Thomson b22369ef 2015-05-18T17:01:37 diff conflicts: test index to workdir w/ conflicts
Edward Thomson bb815157 2015-05-18T16:23:13 diff conflicts: add tests for tree to index
Edward Thomson 07bbc045 2015-04-29T11:58:10 git_path_dirload: use git_path_diriter
Edward Thomson f78d9b6c 2015-03-03T23:56:54 diff_tform: account for whitespace options When comparing seemingly blank files, take whitespace options into account.
Edward Thomson a212716f 2015-03-03T18:19:42 diff_tform: don't compare empty hashsig_heaps Don't try to compare two empty hashsig_heaps.
Carlos Martín Nieto 659cf202 2015-01-07T12:23:05 Remove the signature from ref-modifying functions The signature for the reflog is not something which changes dynamically. Almost all uses will be NULL, since we want for the repository's default identity to be used, making it noise. In order to allow for changing the identity, we instead provide git_repository_set_ident() and git_repository_ident() which allow a user to override the choice of signature.
Pierre-Olivier Latour 36fc5497 2014-12-02T05:11:12 Added GIT_HASHSIG_ALLOW_SMALL_FILES to allow computing signatures for small files The implementation of the hashsig API disallows computing a signature on small files containing only a few lines. This new flag disables this behavior. git_diff_find_similar() sets this flag by default which means that rename / copy detection of small files will now work. This in turn affects the behavior of the git_status and git_blame APIs which will now detect rename of small files assuming the right options are passed.
Carlos Martín Nieto f7fcb18f 2014-11-23T14:12:54 Plug leaks Valgrind is now clean except for libssl and libgcrypt.
Carlos Martín Nieto 62a617dc 2014-11-06T16:16:46 iterator: submodules are determined by an index or tree We cannot know from looking at .gitmodules whether a directory is a submodule or not. We need the index or tree we are comparing against to tell us. Otherwise we have to assume the entry in .gitmodules is stale or otherwise invalid. Thus we pass the index of the repository into the workdir iterator, even if we do not want to compare against it. This follows what git does, which even for `git diff <tree>`, it will consider staged submodules as such.
Edward Thomson 0cee70eb 2014-07-01T14:09:01 Introduce cl_assert_equal_oid
Cha, Hojeong 3ac1ff42 2014-05-27T23:32:38 Fix compile error on Visual Studio
Russell Belfer 8af4966d 2014-05-16T16:30:58 Git binary check compat tests A variety of data patterns for diffs verified to match the behavior of binary detection with Git on the command line.
Vicent Marti 03fcef18 2014-05-13T12:40:13 Merge pull request #2328 from libgit2/rb/how-broken-can-ignores-be Improve checks for ignore containment
Russell Belfer ce3b71d9 2014-05-12T10:28:45 Don't scale diff stat when not needed
Russell Belfer f554611a 2014-05-06T12:41:26 Improve checks for ignore containment The diff code was using an "ignored_prefix" directory to track if a parent directory was ignored that contained untracked files alongside tracked files. Unfortunately, when negative ignore rules were used for directories inside ignored parents, the wrong rules were applied to untracked files inside the negatively ignored child directories. This commit moves the logic for ignore containment into the workdir iterator (which is a better place for it), so the ignored-ness of a directory is contained in the frame stack during traversal. This allows a child directory to override with a negative ignore and yet still restore the ignored state of the parent when we traverse out of the child. Along with this, there are some problems with "directory only" ignore rules on container directories. Given "a/*" and "!a/b/c/" (where the second rule is a directory rule but the first rule is just a generic prefix rule), then the directory only constraint was having "a/b/c/d/file" match the first rule and not the second. This was fixed by having ignore directory-only rules test a rule against the prefix of a file with LEADINGDIR enabled. Lastly, spot checks for ignores using `git_ignore_path_is_ignored` were tested from the top directory down to the bottom to deal with the containment problem, but this is wrong. We have to test bottom to top so that negative subdirectory rules will be checked before parent ignore rules. This does change the behavior of some existing tests, but it seems only to bring us more in line with core Git, so I think those changes are acceptable.
Russell Belfer 9c8ed499 2014-04-29T15:05:58 Remove trace / add git_diff_perfdata struct + api
Russell Belfer 7a2e56a3 2014-04-29T14:30:15 Get rid of redundant git_diff_options_init fn Since git_diff_init_options was introduced, remove this old fn.
Russell Belfer b23b112d 2014-04-29T11:29:49 Add payloads, bitmaps to trace API This is a proposed adjustment to the trace APIs. This makes the trace levels into a bitmask so that they can be selectively enabled and adds a callback-level payload, plus a message-level payload. This makes it easier for me to a GIT_TRACE_PERF callbacks that are simply bypassed if the PERF level is not set.
Russell Belfer 225aab5d 2014-04-28T16:47:39 Don't use trace if GIT_TRACE not defined