summaryrefslogtreecommitdiff
path: root/tests/diff
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* | Don't scale diff stat when not neededRussell Belfer2014-05-121-0/+4
|/
* Remove trace / add git_diff_perfdata struct + apiRussell Belfer2014-05-023-73/+20
|
* Get rid of redundant git_diff_options_init fnRussell Belfer2014-05-022-2/+2
| | | | Since git_diff_init_options was introduced, remove this old fn.
* Add payloads, bitmaps to trace APIRussell Belfer2014-05-023-25/+37
| | | | | | | | | 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.
* Don't use trace if GIT_TRACE not definedRussell Belfer2014-05-021-0/+8
|
* Add GIT_STATUS_OPT_UPDATE_INDEX and use trace APIRussell Belfer2014-05-021-21/+45
| | | | | | This adds an option to refresh the stat cache while generating status. It also rips out the GIT_PERF stuff I had an makes use of the trace API to keep statistics about what happens during diff.
* Add diff option to update index stat cacheRussell Belfer2014-05-021-0/+87
| | | | | | | | | | When diff is scanning the working directory, if it finds a file where it is not sure if the index entry matches the working dir, it will recalculate the OID (which is pretty expensive). This adds a new flag to diff so that if the OID calculation finds that the file actually has not changed (i.e. just the modified time was altered or such), then it will refresh the stat cache in the index so that future calls to diff will not have to check the oid again.
* Skip diff oid calc when size definitely changedRussell Belfer2014-05-021-2/+2
| | | | | | | | | | | | | When we think the stat cache in the index seems valid and the size or mode of a file has definitely changed, then don't bother trying to recalculate the OID of the workdir bits to confirm that it is modified - just accept that it is modified. This can result in files that show as modified with no actual diff, but the behavior actually appears to match Git on the command line. This also includes a minor optimization to not perform a submodule lookup on the ".git" directory itself.
* Add build option for diff internal statisticsRussell Belfer2014-05-021-0/+12
|
* Merge pull request #2291 from ethomson/patch_binaryVicent Marti2014-04-232-0/+264
|\ | | | | patch: emit deflated binary patches (optionally)
| * patch: emit binary patches (optionally)Edward Thomson2014-04-222-0/+264
| |
* | Use git_diff_get_stats in example/diff + refactorRussell Belfer2014-04-222-391/+159
|/ | | | | | | | | | | | | | | | | | | | | This takes the `--stat` and related example options in the example diff.c program and converts them to use the `git_diff_get_stats` API which nicely formats stats for you. I went to add bar-graph scaling to the stats formatter and noticed that the `git_diff_stats` structure was holding on to all of the `git_patch` objects. Unfortunately, each of these objects keeps the full text of the diff in memory, so this is very expensive. I ended up modifying `git_diff_stats` to keep just the data that it needs to keep and allowed it to release the patches. Then, I added width scaling to the output on top of that. In making the diff example program match 'git diff' output, I ended up removing an newline from the sumamry output which I then had to compensate for in the email formatting to match the expectations. Lastly, I went through and refactored the tests to use a couple of helper functions and reduce the overall amount of code there.
* Index locking and entry allocation changesRussell Belfer2014-04-171-2/+1
| | | | | | | | | | | | | | | | | This makes the lock management on the index a little bit broader, having a number of routines hold the lock across looking up the item to be modified and actually making the modification. Still not true thread safety, but more pure index modifications are now safe which allows the simple cases (such as starting up a diff while index modifications are underway) safe enough to get the snapshot without hitting allocation problems. As part of this, I simplified the allocation of index entries to use a flex array and just put the path at the end of the index entry. This makes every entry self-contained and makes it a little easier to feel sure that pointers to strings aren't being accidentally copied and freed while other references are still being held.
* Decouple index iterator sort from indexRussell Belfer2014-04-171-7/+51
| | | | | | | | This makes the index iterator honor the GIT_ITERATOR_IGNORE_CASE and GIT_ITERATOR_DONT_IGNORE_CASE flags without modifying the index data itself. To take advantage of this, I had to export a number of the internal index entry comparison functions. I also wrote some new tests to exercise the capability.
* Add public diff print helpersRussell Belfer2014-04-171-22/+7
| | | | | | | The usefulness of these helpers came up for me while debugging some of the iterator changes that I was making, so since they have also been requested (albeit indirectly) I thought I'd include them.
* Added a test case for formatting a binary patch e-mailJacques Germishuys2014-04-151-0/+43
|
* Sanitize git_diff_format_email_options' summary parameterJacques Germishuys2014-04-151-0/+68
| | | | It will form part of the subject line and should thus be one line.
* Introduce git_diff_format_email and git_diff_commit_as_emailJacques Germishuys2014-04-151-0/+445
|
* Introduce git_diff_get_stats, git_diff_stats_files_changed, ↵Jacques Germishuys2014-04-151-0/+428
| | | | git_diff_stats_insertions, git_diff_stats_deletions and git_diff_stats_to_buf