summaryrefslogtreecommitdiff
path: root/tests-clar/diff
Commit message (Collapse)AuthorAgeFilesLines
...
* Control for core.autocrlf during testingRussell Belfer2013-03-011-2/+13
|
* Merge pull request #1233 from arrbee/file-similarity-metricVicent Martí2013-02-275-19/+244
|\ | | | | Add file similarity scoring to diff rename/copy detection
| * More rename detection testsRussell Belfer2013-02-221-15/+99
| | | | | | | | | | | | This includes tests for crlf changes, whitespace changes with the default comparison and with the ignore whitespace comparison, and more sensitivity checking for the comparison code.
| * Fix tests for find_similar and relatedRussell Belfer2013-02-222-14/+41
| | | | | | | | | | | | | | | | This fixes both a test that I broke in diff::patch where I was relying on the current state of the working directory for the renames test data and fixes an unstable test in diff::rename where the environment setting for the "diff.renames" config was being allowed to influence the test results.
| * Add diff rename tests with partial similarityRussell Belfer2013-02-211-2/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds some new tests that actually exercise the similarity metric between files to detect renames, copies, and split modified files that are too heavily modified. There is still more testing to do - these tests are just partially covering the cases. There is also one bug fix in this where a change set with only MODIFY being broken into ADD/DELETE (due to low self-similarity) without any additional RENAMED entries would end up not processing the split requests (because the num_rewrites counter got reset).
| * Initial integration of similarity metric to diffRussell Belfer2013-02-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the initial integration of the similarity metric into the `git_diff_find_similar()` code path. The existing tests all pass, but the new functionality isn't currently well tested. The integration does go through the pluggable metric interface, so it should be possible to drop in an alternative to the internal metric that libgit2 implements. This comes along with a behavior change for an existing interface; namely, passing two NULLs to git_diff_blobs (or passing NULLs to git_diff_blob_to_buffer) will now call the file_cb parameter zero times instead of one time. I know it's strange that that change is paired with this other change, but it emerged from some initialization changes that I ended up making.
| * Replace diff delta binary with flagsRussell Belfer2013-02-202-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the git_diff_delta recorded if the delta was binary. This replaces that (with no net change in structure size) with a full set of flags. The flag values that were already in use for individual git_diff_file objects are reused for the delta flags, too (along with renaming those flags to make it clear that they are used more generally). This (a) makes things somewhat more consistent (because I was using a -1 value in the "boolean" binary field to indicate unset, whereas now I can just use the flags that are easier to understand), and (b) will make it easier for me to add some additional flags to the delta object in the future, such as marking the results of a copy/rename detection or other deltas that might want a special indicator. While making this change, I officially moved some of the flags that were internal only into the private diff header. This also allowed me to remove a gross hack in rename/copy detect code where I was overwriting the status field with an internal value.
* | Rename 'exp' so it doesn't conflict with exp()Philip Kelley2013-02-221-59/+59
|/
* Merge pull request #1318 from nulltoken/topic/diff-tree-coverageVicent Martí2013-02-141-44/+126
|\ | | | | Topic/diff tree coverage
| * diff: Enhance tree-to-tree diff test coveragenulltoken2013-02-061-0/+109
| | | | | | | | These tests are related to issue libgit2/libgit2sharp#196
| * diff: refactor git_diff_tree_to_tree() testsnulltoken2013-02-061-45/+18
| |
* | More diff tests with binary dataRussell Belfer2013-02-111-15/+119
| |
* | Merge pull request #1190 from nulltoken/topic/reset-pathsRussell Belfer2013-02-111-3/+3
|\ \ | | | | | | reset: Allow the selective reset of pathspecs
| * | Fix MSVC compilation warningsnulltoken2013-02-051-3/+3
| |/ | | | | | | Fix #1308
* | diff: add a notify callback to `git_diff__from_iterators`yorah2013-02-072-0/+168
|/ | | | | | | | | The callback will be called for each file, just before the `git_delta_t` gets inserted into the diff list. When the callback: - returns < 0, the diff process will be aborted - returns > 0, the delta will not be inserted into the diff list, but the diff process continues - returns 0, the delta is inserted into the diff list, and the diff process continues
* Free buffer at end of testRussell Belfer2013-01-301-0/+2
|
* Add helper for diff line statsRussell Belfer2013-01-301-0/+65
| | | | | | | | | | | | This adds a `git_diff_patch_line_stats()` API that gets the total number of adds, deletes, and context lines in a patch. This will make it a little easier to emulate `git diff --stat` and the like. Right now, this relies on generating the `git_diff_patch` object, which is a pretty heavyweight way to get stat information. At some future point, it would probably be nice to be able to get this information without allocating the entire `git_diff_patch`, but that's a much larger project.
* Fix case sensitivity bug with tree iteratorsRussell Belfer2013-01-221-0/+14
| | | | | | | | With the new code to make tree iterators support ignore_case, there is a bug in setting the start entry for range bounded iterators where memcmp was being used instead of strncasecmp. This fixes that and expands the tree iterator test to cover the cases that were broken.
* Support case insensitive tree iterators and statusRussell Belfer2013-01-151-10/+113
| | | | | | | | | | | This makes tree iterators directly support case insensitivity by using a secondary index that can be sorted by icase. Also, this fixes the ambiguity check in the git_status_file API to also be case insensitive. Lastly, this adds new test cases for case insensitive range boundary checking for all types of iterators. With this change, it should be possible to deprecate the spool and sort iterator, but I haven't done that yet.
* Test for ignore_case ranges on workdir iteratorRussell Belfer2013-01-151-0/+49
| | | | | | This adds a test that confirms that the working directory iterator can actually correctly process ranges of files case insensitively with proper sorting and proper boundaries.
* Update iterator API with flags for ignore_caseRussell Belfer2013-01-151-5/+7
| | | | | | | | | | | | This changes the iterator API so that flags can be passed in to the constructor functions to control the ignore_case behavior. At this point, the flags are not supported on tree iterators (i.e. there is no functional change over the old API), but the API changes are all made to accomodate this. By the way, I went with a flags parameter because in the future I have a couple of other ideas for iterator flags that will make it easier to fix some diff/status/checkout bugs.
* Minor iterator API cleanupsRussell Belfer2013-01-151-1/+4
| | | | | | | | | In preparation for further iterator changes, this cleans up a few small things in the iterator API: * removed the git_iterator_for_repo_index_range API * made git_iterator_free not be inlined * minor param name and test function name tweaks
* Fix diff patch line number calculationRussell Belfer2013-01-111-1/+109
| | | | | | | | This was just wrong. Added a test that verifying patch line numbers even for hunks further into a file and then fixed the algorithm. I needed to add a little extra state into the patch so that I could track old and new file numbers independently, but it should be okay.
* tests: plug a couple of leaksCarlos Martín Nieto2013-01-111-0/+1
|
* Resolve crash with diff against empty fileRussell Belfer2013-01-081-0/+43
| | | | | | | | | | | It is not legal inside our `p_mmap` function to mmap a zero length file. This adds a test that exercises that case inside diff and fixes the code path where we would try to do that. The fix turns out not to be a lot of code since our default file content is already initialized to "" which works in this case. Fixes #1210
* Share git_diff_blobs/git_diff_blob_to_buffer codeRussell Belfer2013-01-071-0/+78
| | | | | | | This moves the implementation of these two APIs into common code that will be shared between the two. Also, this adds tests for the `git_diff_blob_to_buffer` API. Lastly, this adds some extra `const` to a few places that can use it.
* Fix some leaks and (possibly) dangling pointers in testsSascha Cunz2012-12-191-1/+5
| | | | Also adds some asserts.
* Merge pull request #1151 from arrbee/fix-diff-constructor-namesVicent Martí2012-12-173-47/+47
|\ | | | | Fix diff constructor names
| * Fix diff constructor name order confusionRussell Belfer2012-12-173-47/+47
| | | | | | | | | | | | | | | | | | | | | | | | The diff constructor functions had some confusing names, where the "old" side of the diff was coming after the "new" side. This reverses the order in the function name to make it less confusing. Specifically... * git_diff_index_to_tree becomes git_diff_tree_to_index * git_diff_workdir_to_index becomes git_diff_index_to_workdir * git_diff_workdir_to_tree becomes git_diff_tree_to_workdir
* | blob: introduce git_blob_is_binary()nulltoken2012-12-171-0/+12
|/
* Fix iterator reset and add reset rangesRussell Belfer2012-12-101-6/+32
| | | | | | | The `git_iterator_reset` command has not been working in all cases particularly when there is a start and end range. This fixes it and adds tests for it, and also extends it with the ability to update the start/end range strings when an iterator is reset.
* Clean up iterator APIsRussell Belfer2012-12-101-2/+2
| | | | | | | | This removes the need to explicitly pass the repo into iterators where the repo is implied by the other parameters. This moves the repo to be owned by the parent struct. Also, this has some iterator related updates to the internal diff API to lay the groundwork for checkout improvements.
* Deploy GIT_INIT_STRUCTUREBen Straub2012-11-302-7/+1
|
* Deploy GIT_DIFF_FIND_OPTIONS_INITBen Straub2012-11-301-2/+33
|
* Deploy GIT_DIFF_OPTIONS_INITBen Straub2012-11-307-21/+140
|
* Merge pull request #1090 from arrbee/ignore-invalid-by-defaultVicent Martí2012-11-291-0/+56
|\ | | | | Ignore invalid entries by default
| * Improve iterator ignoring .git fileRussell Belfer2012-11-191-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | The workdir iterator has always tried to ignore .git files, but it turns out there were some bugs. This makes it more robust at ignoring .git files. This also makes iterators always check ".git" case insensitively regardless of the properties of the system. This will make libgit2 skip ".GIT" and the like. This is different from core git, but on systems with case insensitive but case preserving file systems, allowing ".GIT" to be added is problematic.
* | diff: enhance test coverage against the workdirnulltoken2012-11-281-0/+23
| |
* | Fix warnings on Win64 buildRussell Belfer2012-11-271-1/+1
| |
* | Update diff callback param orderRussell Belfer2012-11-278-98/+99
| | | | | | | | | | | | | | | | This makes the diff functions that take callbacks both take the payload parameter after the callback function pointers and pass the payload as the last argument to the callback function instead of the first. This should make them consistent with other callbacks across the API.
* | More external API cleanupVicent Marti2012-11-277-84/+86
| | | | | | | | | | | | Conflicts: src/branch.c tests-clar/refs/branches/create.c
* | Reset all static variables to NULL in clar's __cleanupSascha Cunz2012-11-231-0/+3
|/ | | | | | | | | | | | Without this change, any failed assertion in the second (or a later) test inside a test suite has a chance of double deleting memory, resulting in a heap corruption. See #1096 for details. This leaves alone the test cases where we "just" use cl_git_sandbox_init() and cl_git_sandbox_cleanup(). These methods already take good care to not double delete a repository. Fixes #1096
* Add explicit git_index ptr to diff and checkoutRussell Belfer2012-11-143-32/+32
| | | | | | | | A number of diff APIs and the `git_checkout_index` API take a `git_repository` object an operate on the index. This updates them to take a `git_index` pointer explicitly and only fall back on the `git_repository` index if the index input is NULL. This makes it easier to operate on a temporary index.
* Add iterator for git_index objectRussell Belfer2012-11-141-1/+1
| | | | | | The index iterator could previously only be created from a repo object, but this allows creating an iterator from a `git_index` object instead (while keeping, though renaming, the old function).
* Fix diff API to better parameter orderRussell Belfer2012-11-146-49/+52
| | | | | The diff API is not in the parameter order one would expect from other libgit2 APIs. This fixes that.
* Merge pull request #1014 from arrbee/diff-rename-detectionVicent Martí2012-11-027-157/+246
|\ | | | | Initial implementation of diff rename detection
| * Move rename detection into new fileRussell Belfer2012-10-301-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This improves the naming for the rename related functionality moving it to be called `git_diff_find_similar()` and renaming all the associated constants, etc. to make more sense. I also moved the new code (plus the existing `git_diff_merge`) into a new file `diff_tform.c` where I can put new functions related to manipulating git diff lists. This also updates the implementation significantly from the last revision fixing some ordering issues (where break-rewrite needs to be handled prior to copy and rename detection) and improving config option handling.
| * Initial implementation of diff rename detectionRussell Belfer2012-10-237-157/+246
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements the basis for diff rename and copy detection, although it is based on simple SHA comparison right now instead of using a matching algortihm. Just as `git_diff_merge` can be used as a post-pass on diffs to emulate certain command line behaviors, there is a new API `git_diff_detect` which will update a diff list in-place, adjusting some deltas to RENAMED or COPIED state (and also, eventually, splitting MODIFIED deltas where the change is too large into DELETED/ADDED pairs). This also adds a new test repo that will hold rename/copy/split scenarios. Right now, it just has exact-match rename and copy, but the tests are written to use tree diffs, so we should be able to add new test scenarios easily without breaking tests.
* | Add git_diff_patch_to_str APIRussell Belfer2012-10-242-0/+129
|/ | | | | This adds an API to generate a complete single-file patch text from a git_diff_patch object.
* diff: workdir diffing in a bare repo returns EBAREREPOnulltoken2012-10-181-0/+17
|