summaryrefslogtreecommitdiff
path: root/tests/diff
Commit message (Collapse)AuthorAgeFilesLines
* Teach `git_patch_from_diff` about parsed diffsethomson/patch_from_diffEdward Thomson2016-08-241-0/+45
| | | | | Ensure that `git_patch_from_diff` can return the patch for parsed diffs, not just generate a patch for a generated diff.
* patch: show copy information for identical copiesEdward Thomson2016-06-254-13/+98
| | | | | | | 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.
* patch::parse: test diff with exact rename and copyEdward Thomson2016-06-251-0/+5
|
* patch::parse: test diff with simple renameEdward Thomson2016-06-251-12/+27
|
* diff::parse tests: test parsing a diffEdward Thomson2016-06-253-0/+107
| | | | | Test that we can create a diff file, then parse the results and that the two are identical in-memory.
* introduce `git_diff_from_buffer` to parse diffsEdward Thomson2016-05-261-0/+60
| | | | Parse diff files into a `git_diff` structure.
* git_diff_generated: abstract generated diffsEdward Thomson2016-05-262-0/+2
|
* diff: test submodules are found with trailing `/`Edward Thomson2016-04-021-0/+47
| | | | | Test that submodules are found when the are included in a pathspec but have a trailing slash.
* iterator: give the tests a proper hierarchyEdward Thomson2016-03-241-1005/+0
| | | | | | 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.
* Added clar test for #3568Jeff Hostetler2016-03-231-0/+129
|
* iterators: refactored tree iteratorEdward Thomson2016-03-231-10/+3
| | | | | | | | 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.)
* iterator: disambiguate reset and reset_rangeEdward Thomson2016-03-231-2/+2
| | | | | | 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.
* tree: re-use the id and filename in the odb objectCarlos Martín Nieto2016-03-201-1/+1
| | | | | Instead of copying over the data into the individual entries, point to the originals, which are already in a format we can use.
* tests: take the version from our defineCarlos Martín Nieto2016-03-031-1/+1
|
* tests: use legitimate object idsEdward Thomson2016-02-282-7/+9
| | | | | Use legitimate (existing) object IDs in tests so that we have the ability to turn on strict object validation when running tests.
* Merge pull request #3613 from ethomson/fixupsCarlos Martín Nieto2016-02-181-2/+2
|\ | | | | Remove most of the silly warnings
| * win32: introduce p_timeval that isn't stupidEdward Thomson2016-02-121-2/+2
| | | | | | | | | | Windows defines `timeval` with `long`, which we cannot sanely cope with. Instead, use a custom timeval struct.
* | Horrible fix for #3173.Arthur Schreiber2016-02-111-2/+2
|/
* diff: include commit message when formatting patchPatrick Steinhardt2015-12-011-0/+41
| | | | | | 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.
* Fix some warningsJacques Germishuys2015-11-201-0/+1
|
* Merge pull request #3498 from ethomson/windows_symlinksCarlos Martín Nieto2015-11-081-0/+61
|\ | | | | Diff: Honor `core.symlinks=false` and fake symlinks
| * diff: test "symlinks" in wd are respected on win32Edward Thomson2015-11-031-0/+61
| | | | | | | | | | | | | | | | 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).
* | Add diff progress callback.Jason Haslam2015-11-022-2/+29
|/
* tests: Fix warningsvmg/crudVicent Marti2015-10-211-1/+1
|
* 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
| | |