summaryrefslogtreecommitdiff
path: root/tests/diff
Commit message (Collapse)AuthorAgeFilesLines
* Fix binary diffsGuille -bisho-2015-09-251-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-
* diff::workdir: ensure ignored files are not returnedEdward Thomson2015-09-121-0/+43
| | | | | Ensure that a diff with the workdir is not erroneously returning directories.
* iterator: saner pathlist matching for idx iteratorEdward Thomson2015-08-311-24/+0
| | | | | | | | | | | | 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.
* diff: use new iterator pathlist handlingEdward Thomson2015-08-301-1/+25
| | | | | | | | 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`.
* diff: better document GIT_DIFF_PATHSPEC_DISABLEEdward Thomson2015-08-281-0/+210
| | | | | | 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.
* iterator: use an options struct instead of argsEdward Thomson2015-08-281-14/+46
|
* diff: don't error out on an invalid regexcmn/regex-nofailCarlos Martín Nieto2015-08-151-0/+26
| | | | | | 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.
* Added git_diff_index_to_index()Pierre-Olivier Latour2015-06-301-0/+32
|
* Merge pull request #3265 from libgit2/leaksCarlos Martín Nieto2015-06-271-1/+5
|\ | | | | Plug a bunch of leaks
| * diff: fix leaks in diff printingCarlos Martín Nieto2015-06-261-1/+5
| |
* | Merge pull request #3263 from git-up/fixesCarlos Martín Nieto2015-06-262-2/+0
|\ \ | |/ |/| Fixes
| * Removed unused variablesPierre-Olivier Latour2015-06-262-2/+0
| |
* | test-diff-blob: Pass proper nibble sizesvmg/prefix-lenVicent Marti2015-06-261-14/+14
|/
* diff: test we don't update index unnecessarilyEdward Thomson2015-06-261-7/+69
| | | | | Test that workdir diffs, when presented with UPDATE_INDEX, only write the index when they actually make a change.
* Rename FALLBACK to UNSPECIFIEDcmn/rename-unspecifiedCarlos Martín Nieto2015-06-251-1/+1
| | | | | Fallback describes the mechanism, while unspecified explains what the user is thinking.
* Merge pull request #3097 from libgit2/cmn/submodule-config-stateCarlos Martín Nieto2015-06-242-9/+9
|\ | | | | Remove run-time configuration settings from submodules
| * submodule: add an ignore option to statusCarlos Martín Nieto2015-06-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * submodule: make set_ignore() affect the configurationCarlos Martín Nieto2015-06-221-8/+8
| | | | | | | | | | Instead of affecting a particular instance, make it change the configuration.
* | diff::binary tests: empty diff when forced binaryEdward Thomson2015-06-241-0/+30
| | | | | | | | | | | | 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.
* | binary diff: test that the diff and patch otputs are the samecmn/diff-binary-patchCarlos Martín Nieto2015-06-241-0/+7
| | | | | | | | | | | | | | | | 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.
* | Merge pull request #3222 from git-up/conflictedEdward Thomson2015-06-231-1/+30
|\ \ | | | | | | Fixed GIT_DELTA_CONFLICTED not returned in some cases
| * | Fixed GIT_DELTA_CONFLICTED not returned in some casesPierre-Olivier Latour2015-06-231-1/+30
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #3226 from libgit2/cmn/racy-diff-againEdward Thomson2015-06-232-39/+2
|\ \ \ | |/ / |/| | racy-git, the missing link
| * | tests: move racy tests to the indexCarlos Martín Nieto2015-06-221-100/+0
| | | | | | | | | | | | | | | They fit there much better, even though we often check by diffing, it's about the behaviour of the index.
| * | tests: set racy times manuallyCarlos Martín Nieto2015-06-221-6/+26
| | |
| * | tests: plug leaks in the racy testCarlos Martín Nieto2015-06-221-1/+9
| | |
| * | diff: check files with the same or newer timestampsCarlos Martín Nieto2015-06-222-0/+35
| |/ | | | | | | | | | | | | | | | | | | 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.
* | Explicitly handle GIT_DELTA_CONFLICTED in git_diff_merge()Pierre-Olivier Latour2015-06-221-0/+36
|/ | | | | 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.
* Merge pull request #3219 from libgit2/cmn/racy-diffCarlos Martín Nieto2015-06-172-0/+45
|\ | | | | Zero out racily-clean entries' file_size
| * tests: tick the index when we count OID calculationsCarlos Martín Nieto2015-06-161-0/+6
| | | | | | | | | | | | | | | | | | 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.
| * diff: add failing test for racy-git in the indexCarlos Martín Nieto2015-06-161-0/+39
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Fixed Xcode 6.1 build warningsPierre-Olivier Latour2015-06-152-9/+17
|/
* binary diff: test binary blob to blob testsEdward Thomson2015-06-121-0/+130
|
* diff: introduce binary diff callbacksEdward Thomson2015-06-129-163/+182
| | | | | | | 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.
* binary diff: test index->workdir binary diffsEdward Thomson2015-06-121-0/+99
|
* Fixed build warnings on Xcode 6.1Pierre-Olivier Latour2015-06-022-2/+2
|
* diff conflicts: test index to workdir w/ conflictsEdward Thomson2015-05-281-0/+45
|
* diff conflicts: add tests for tree to indexEdward Thomson2015-05-283-2/+78
|
* git_path_dirload: use git_path_diriterEdward Thomson2015-05-011-1/+1
|
* diff_tform: account for whitespace optionsEdward Thomson2015-03-041-6/+68
| | | | | When comparing seemingly blank files, take whitespace options into account.
* diff_tform: don't compare empty hashsig_heapsEdward Thomson2015-03-031-0/+38
| | | | Don't try to compare two empty hashsig_heaps.
* Remove the signature from ref-modifying functionsCarlos Martín Nieto2015-03-031-3/+3
| | | | | | | | | | 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.
* Added GIT_HASHSIG_ALLOW_SMALL_FILES to allow computing signatures for small ↵Pierre-Olivier Latour2015-01-141-19/+35
| | | | | | | | | | | | | 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.
* Plug leaksCarlos Martín Nieto2014-11-231-6/+3
| | | | Valgrind is now clean except for libssl and libgcrypt.
* iterator: submodules are determined by an index or treecmn/submodule-and-dirCarlos Martín Nieto2014-11-071-3/+3
| | | | | | | | | | | | 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.
* Introduce cl_assert_equal_oidEdward Thomson2014-07-012-7/+7
|
* Fix compile error on Visual StudioCha, Hojeong2014-05-271-2/+2
|
* Git binary check compat testsrb/update-4k-to-8kRussell Belfer2014-05-161-0/+114
| | | | | A variety of data patterns for diffs verified to match the behavior of binary detection with Git on the command line.
* Merge pull request #2328 from libgit2/rb/how-broken-can-ignores-beVicent Marti2014-05-131-1/+1
|\ | | | | Improve checks for ignore containment
| * Improve checks for ignore containmentrb/how-broken-can-ignores-beRussell Belfer2014-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.