summaryrefslogtreecommitdiff
path: root/tests/diff
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Remove most submodule reloads from testsRussell Belfer2014-04-011-5/+0
| | | | | | | | | | | With the new submodule cache validity checks, we generally don't need to call git_submodule_reload_all to have up-to-date submodule data. Some tests are still calling it where I want to actually test that it can be called safely and doesn't break anything, but mostly it is not needed. This also expands some of the existing submodule tests to cover some variants on the behavior that was already being tested.
* Improve test of submodule name sortingRussell Belfer2014-03-311-0/+6
|
* Fix memory leak of test repository objectRussell Belfer2014-03-271-2/+5
|
* Merge pull request #2204 from libgit2/rb/submodule-reference-countingVicent Marti2014-03-261-3/+7
|\ | | | | Make submodules externally refcounted
| * Make submodules externally refcountedRussell Belfer2014-03-251-3/+7
| | | | | | | | | | | | | | | | `git_submodule` objects were already refcounted internally in case the submodule name was different from the path at which it was stored. This makes that refcounting externally used as well, so `git_submodule_lookup` and `git_submodule_add_setup` return an object that requires a `git_submodule_free` when done.
* | Update behavior for untracked sub-reposRussell Belfer2014-03-253-6/+68
|/ | | | | | | | | | | When a directory containing a .git directory (or even just a plain gitlink) was found, libgit2 was going out of its way to treat it specially. This seemed like it was necessary because the diff code was not originally emulating Git's behavior for untracked directories correctly (i.e. scanning for ignored vs untracked items inside). Now that libgit2 diff mimics Git's untracked directory behavior, the special handling for contained Git repos is actually incorrect and this commit rips it out.
* git_checkout_opts -> git_checkout_optionsBen Straub2014-03-061-3/+3
|
* Add buffer to buffer diff and patch APIsRussell Belfer2014-02-271-150/+90
| | | | | | | | This adds `git_diff_buffers` and `git_patch_from_buffers`. This also includes a bunch of internal refactoring to increase the shared code between these functions and the blob-to-blob and blob-to-buffer APIs, as well as some higher level assert helpers in the tests to also remove redundancy.
* Merge pull request #2066 from libgit2/rb/builtin-diff-driversVicent Marti2014-01-272-29/+119
|\ | | | | Add built in diff drivers