summaryrefslogtreecommitdiff
path: root/tests/diff
Commit message (Collapse)AuthorAgeFilesLines
* 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
| * Update Javascript userdiff driver and testsRussell Belfer2014-01-271-12/+16
| | | | | | | | | | | | | | | | | | Writing a sample Javascript driver pointed out some extra whitespace handling that needed to be done in the diff driver. This adds some tests with some sample javascript code that I pulled off of GitHub just to see what would happen. Also, to clean up the userdiff test data, I did a "git gc" and packed up the test objects.
| * Move userdiff tests to be data drivenRussell Belfer2014-01-241-47/+50
| | | | | | | | | | | | This moves the expected and actual test data along with the source data for the userdiff tests into the tests/resources/userdiff test repo and updates the test to use that.
| * Update all tests for new pattern extractionRussell Belfer2014-01-241-4/+4
| |
| * Implement matched pattern extract for fn headersRussell Belfer2014-01-241-2/+2
| |
| * Fix filemode updating in diff textRussell Belfer2014-01-241-7/+15
| |
| * Import git drivers and test HTML driverRussell Belfer2014-01-241-24/+99
| | | | | | | | | | | | | | | | | | | | Reorganize the builtin driver table slightly so that core Git builtin definitions can be imported verbatim. Then take a few of the core Git drivers and pull them in. This also creates a test of diffs with the builtin HTML driver which led to some small error handling fixes in the driver selection logic.
* | diff: rename the file's 'oid' to 'id'Carlos Martín Nieto2014-01-251-16/+16
| | | | | | | | In the same vein as the previous commits in this series.
* | index: rename an entry's id to 'id'Carlos Martín Nieto2014-01-251-1/+1
|/ | | | This was not converted when we converted the rest, so do it now.
* Drop git_patch_to_strNicolas Hake2014-01-227-89/+94
| | | | | | | It's hard or even impossible to correctly free the string buffer allocated by git_patch_to_str in some circumstances. Drop the function so people have to use git_patch_to_buf instead - git_buf has a dedicated destructor.
* refs: remove the _with_log differentiationCarlos Martín Nieto2014-01-151-3/+3
| | | | | | Any well-behaved program should write a descriptive message to the reflog whenever it updates a reference. Let's make this more prominent by removing the version without the reflog parameters.
* More tests of canceling from callbacksRussell Belfer2013-12-121-3/+36
| | | | | This covers diff print, push, and ref foreach. This also has a fix for a small memory leak in the push tests.
* More improvements to callback return value testsRussell Belfer2013-12-111-2/+4
| | | | | | This time actually checking return values in diff notify tests and actually testing callbacks for the index all-all/update-all/etc functions.
* Remove converting user error to GIT_EUSERRussell Belfer2013-12-113-4/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the behavior of callbacks so that the callback error code is not converted into GIT_EUSER and instead we propagate the return value through to the caller. Instead of using the giterr_capture and giterr_restore functions, we now rely on all functions to pass back the return value from a callback. To avoid having a return value with no error message, the user can call the public giterr_set_str or some such function to set an error message. There is a new helper 'giterr_set_callback' that functions can invoke after making a callback which ensures that some error message was set in case the callback did not set one. In places where the sign of the callback return value is meaningful (e.g. positive to skip, negative to abort), only the negative values are returned back to the caller, obviously, since the other values allow for continuing the loop. The hardest parts of this were in the checkout code where positive return values were overloaded as meaningful values for checkout. I fixed this by adding an output parameter to many of the internal checkout functions and removing the overload. This added some code, but it is probably a better implementation. There is some funkiness in the network code where user provided callbacks could be returning a positive or a negative value and we want to rely on that to cancel the loop. There are still a couple places where an user error might get turned into GIT_EUSER there, I think, though none exercised by the tests.
* Don't clobber whitespace settingsBen Straub2013-12-061-0/+42
|
* Don't use weird return codesBen Straub2013-12-051-0/+3
|
* Implement GIT_DIFF_FIND_BY_CONFIGBen Straub2013-12-051-0/+138
|
* GIT_DIFF_FIND_REMOVE_UNMODIFIED sounds betterRussell Belfer2013-12-021-1/+1
|
* Add GIT_DIFF_FIND_DELETE_UNMODIFIED flagRussell Belfer2013-12-021-0/+48
| | | | | | | | | | When doing copy detection, it is often necessary to include UNMODIFIED records in the git_diff so they are available as source records for GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED. Yet in the final diff, often you will not want to have these UNMODIFIED records. This adds a flag which marks these UNMODIFIED records for deletion from the diff list so they will be removed after the rename detect phase is over.
* Fix bug making split deltas a COPIED targetsRussell Belfer2013-12-021-0/+49
| | | | | | | | When FIND_COPIES is used in combination with BREAK_REWRITES for rename detection, there was a bug where the split MODIFIED delta was only used as a target for RENAME records and not for COPIED records. This fixes that, converting the split into a pair of DELETED and COPIED deltas when that circumstance arises.
* Add content offset to git_diff_lineNick Hengeveld2013-11-181-0/+6
| | | | | | For additions and deletions, external consumers like subversion can make use of the content offset to generate diffs in their proprietary formats.
* Rename tests-clar to testsBen Straub2013-11-1414-0/+7714