summaryrefslogtreecommitdiff
path: root/tests-clar/diff
Commit message (Collapse)AuthorAgeFilesLines
* Rename tests-clar to testsBen Straub2013-11-1414-7714/+0
|
* Fix leaksnulltoken2013-11-051-0/+2
|
* Merge pull request #1929 from libgit2/rb/misc-diff-fixesVicent Martí2013-11-044-11/+169
|\ | | | | Fix some observed problems with incorrect diffs
| * Fix --assume-unchanged supportRussell Belfer2013-11-011-0/+54
| | | | | | | | | | | | | | This was never really working right because we were checking the wrong flag and not checking it in all the places that we need to be checking it. I finally got around to writing a test and adding actual support for it.
| * More tests and fixed for merging reversed diffsRussell Belfer2013-11-011-0/+32
| | | | | | | | | | | | There were a lot more cases to deal with to make sure that our merged (i.e. workdir-to-tree-to-index) diffs were matching the output of core Git.
| * Add git_diff_options_init helperRussell Belfer2013-11-012-6/+4
| | | | | | | | | | | | | | | | | | Sometimes the static initializer for git_diff_options cannot be used and since setting them to all zeroes doesn't actually work quite right, this adds a new helper for that situation. This also adds an explicit new value to the submodule settings options to be used when those enums need static initialization.
| * Make diff and status perform soft index reloadRussell Belfer2013-11-012-5/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes `git_index_read` to have two modes - a hard index reload that always resets the index to match the on-disk data (which was the old behavior) and a soft index reload that uses the timestamp / file size information and only replaces the index data if the file on disk has been modified. This then updates the git_status code to do a soft reload unless the new GIT_STATUS_OPT_NO_REFRESH flag is passed in. This also changes the behavior of the git_diff functions that use the index so that when an index is not explicitly passed in (i.e. when the functions call git_repository_index for you), they will also do a soft reload for you. This intentionally breaks the file signature of git_index_read because there has been some confusion about the behavior previously and it seems like all existing uses of the API should probably be examined to select the desired behavior.
* | Fix a leak in the diff testsCarlos Martín Nieto2013-11-021-0/+1
|/
* Implement patience and minimal diff flagsRussell Belfer2013-10-211-0/+47
| | | | | | It seems that to implement these options, we just have to pass the appropriate flags through to the libxdiff code taken from core git. So let's do it (and add a test).
* Create git_diff_line and extend git_diff_hunkRussell Belfer2013-10-217-215/+164
| | | | | | | | | | | | | Instead of having functions with so very many parameters to pass hunk and line data, this takes the existing git_diff_hunk struct and extends it with more hunk data, plus adds a git_diff_line. Those structs are used to pass back hunk and line data instead of the old APIs that took tons of parameters. Some work that was previously only being done for git_diff_patch creation (scanning the diff content for exact line counts) is now done for all callbacks, but the performance difference should not be noticable.
* Diff API cleanupRussell Belfer2013-10-159-81/+92
| | | | | | | | This lays groundwork for separating formatting options from diff creation options. This groups the formatting flags separately from the diff list creation flags and reorders the options. This also tweaks some APIs to further separate code that uses patches from code that just looks at git_diffs.
* Rename diff objects and split patch.hRussell Belfer2013-10-1113-500/+500
| | | | | | This makes no functional change to diff but renames a couple of the objects and splits the new git_patch (formerly git_diff_patch) into a new header file.
* Rename new fn to git_repository_reinit_filesystemRussell Belfer2013-10-081-2/+2
|
* More filemode cleanups for FAT on MacOSRussell Belfer2013-10-082-12/+3
| | | | | | | | | | | | | | | | | | | | | | This cleans up some additional issues. The main change is that on a filesystem that doesn't support mode bits, libgit2 will now create new blobs with GIT_FILEMODE_BLOB always instead of being at the mercy to the filesystem driver to report executable or not. This means that if "core.filemode" lies and claims that filemode is not supported, then we will ignore the executable bit from the filesystem. Previously we would have allowed it. This adds an option to the new git_repository_reset_filesystem to recurse through submodules if desired. There may be other types of APIs that would like a "recurse submodules" option, but this one is particularly useful. This also has a number of cleanups, etc., for related things including trying to give better error messages when problems come up from the filesystem. For example, the FAT filesystem driver on MacOS appears to return errno EINVAL if you attempt to write a filename with invalid UTF-8 in it. We try to capture that with a better error message now.
* Add git_repository_reset_filesystem and fix testsRussell Belfer2013-10-044-12/+56
| | | | | | | | | | | | | | | | | When a repository is transferred from one file system to another, many of the config settings that represent the properties of the file system may be wrong. This adds a new public API that will refresh the config settings of the repository to account for the change of file system. This doesn't do a full "reinitialize" and operates on a existing git_repository object refreshing the config when done. This commit then makes use of the new API in clar as each test repository is set up. This commit also has a number of other clar test fixes where we were making assumptions about the type of filesystem, either based on outdated config data or based on the OS instead of the FS.
* Fix incorrect return code in crlf filterRussell Belfer2013-09-241-0/+25
| | | | | | The git_buf_text_gather_stats call returns a boolean indicating if the file looks like binary data. That shouldn't be an error; it should be used to skip CRLF processing though.
* Add clar helper to create new commit from indexRussell Belfer2013-09-171-22/+3
| | | | | | | | There were a lot of places in the test code base that were creating a commit from the index on the current branch. This just adds a helper to handle that case pretty easily. There was only one test where this change ended up tweaking the test data, so pretty easy and mostly just a cleanup.
* Fixing up some win32 issues with autocrlfRussell Belfer2013-09-171-0/+2
|
* Rearrange clar submodule cleanup codeRussell Belfer2013-09-171-1/+0
|
* Fix some newer GCC compiler warningsRussell Belfer2013-09-051-3/+0
|
* Update clarRussell Belfer2013-09-041-2/+3
|
* Split rewrites, status doesn't return rewritesEdward Thomson2013-08-281-0/+49
| | | | | | | | Ensure that we apply splits to rewrites, even if we're not interested in examining it closely for rename/copy detection. In keeping with core git, status should not display rewrites, it should simply show files as "modified".
* Merge pull request #1738 from libgit2/diff-patch-content-sizeBen Straub2013-08-081-20/+39
|\ | | | | Add API for getting at git_diff_patch->content_size
| * Add hunk/file headers to git_diff_patch_sizeRussell Belfer2013-07-231-29/+37
| | | | | | | | | | | | | | | | | | | | | | This allows git_diff_patch_size to account for hunk headers and file headers in the returned size. This required some refactoring of the code that is used to print file headers so that it could be invoked by the git_diff_patch_size API. Also this increases the test coverage and fixes an off-by-one bug in the size calculation when newline changes happen at the end of the file.
| * Add git_diff_patch_size() APIRussell Belfer2013-07-221-4/+15
| | | | | | | | | | This adds a new API to get the size in bytes of the diffs in a git_diff_patch object.
* | Move slow tests to "stress" clar moduleRussell Belfer2013-08-051-147/+0
| | | | | | | | | | | | Create a new section of clar tests "stress" that will default to being off where we can put slow tests that push the library for performance testing purposes.
* | Restore commented out testsRussell Belfer2013-08-041-8/+2
| | | | | | | | | | This restores the commented out tests (even though they're slow) and fixes some trailing whitespace.
* | Rename test for rename from rewriteEdward Thomson2013-08-041-0/+56
| | | | | | | | A rename test that illustrates a rename from a rewrite.
* | Rename test for multiple similar matchesEdward Thomson2013-08-041-3/+63
| | | | | | | | A rename test that illustrates a source matching multiple targets.
* | Major rename detection changesRussell Belfer2013-07-311-26/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After doing further profiling, I found that a lot of time was being spent attempting to insert hashes into the file hash signature when using the rolling hash because the rolling hash approach generates a hash per byte of the file instead of one per run/line of data. To optimize this, I decided to convert back to a run-based file signature algorithm which would be more like core Git. After changing this, a number of the existing tests started to fail. In some cases, this appears to have been because the test was coded to be too specific to the particular results of the file similarity metric and in some cases there appear to have been bugs in the core rename detection code where only by the coincidence of the file similarity scoring were the expected results being generated. This renames all the variables in the core rename detection code to be more consistent and hopefully easier to follow which made it a bit easier to reason about the behavior of that code and fix the problems that I was seeing. I think it's in better shape now. There are a couple of tests now that attempt to stress test the rename detection code and they are quite slow. Most of the time is spent setting up the test data on disk and in the index. When we roll out performance improvements for index insertion, it should also speed up these tests I hope.
* | Fix rename detection for tree-to-tree diffsRussell Belfer2013-07-241-2/+48
| | | | | | | | | | | | | | | | | | | | | | | | The performance improvements I introduced for rename detection were not able to run successfully for tree-to-tree diffs because the blob size was not known early enough and so the file signature always had to be calculated nonetheless. This change separates loading blobs into memory from calculating the signature. I can't avoid having to load the large blobs into memory, but by moving it forward, I'm able to avoid the signature calculation if the blob won't come into play for renames.
* | Add rename test that used to be really slowRussell Belfer2013-07-241-0/+57
|/ | | | | | | Before the optimization commits, this test used to take about 20 seconds to run on my machine. Afterwards, there is still a couple seconds of data setup, but the actual diff and rename detection runs in a fraction of a second.
* tests: Fix memory leaknulltoken2013-07-131-0/+1
|
* Fix warnings on Win64Russell Belfer2013-07-111-7/+7
|
* Untracked directories with .git should be ignoredRussell Belfer2013-07-102-42/+12
| | | | | | | | | | | | | | | | | This restores a behavior that was accidentally lost during some diff refactoring where an untracked directory that contains a .git item should be treated as IGNORED, not as UNTRACKED. The submodule code already detects this, but the diff code was not handling the scenario right. This also updates a number of existing tests that were actually exercising the behavior but did not have the right expectations in place. It actually makes the new `test_diff_submodules__diff_ignore_options` test feel much better because the "not-a-submodule" entries are now ignored instead of showing up as untracked items. Fixes #1697
* Add tests for diff.ignoreSubmdules configRussell Belfer2013-07-101-0/+29
|
* Add ignore_submodules to diff optionsRussell Belfer2013-07-101-3/+62
| | | | | | | | | | | | | | | | | | | | This adds correct support for an equivalent to --ignore-submodules in diff, where an actual ignore value can be passed to diff to override the per submodule settings in the configuration. This required tweaking the constants for ignore values so that zero would not be used and could represent an unset option to the diff. This was an opportunity to move the submodule values into include/git2/types.h and to rename the poorly named DEFAULT values for ignore and update constants to RESET instead. Now the GIT_DIFF_IGNORE_SUBMODULES flag is exactly the same as setting the ignore_submodules option to GIT_SUBMODULE_IGNORE_ALL (which is actually a minor change from the old behavior in that submodules will now be treated as UNMODIFIED deltas instead of being left out totally - if you set GIT_DIFF_INCLUDE_UNMODIFIED). This includes tests for the various new settings.
* Update diff to new internal submodule status APIRussell Belfer2013-07-101-7/+0
| | | | | | | Submodules now expose an internal status API that allows diff to get back the OID values from the submodule very easily and also to avoiding caching issues and to override the ignore setting for the submodule.
* Add timestamp check to submodule statusRussell Belfer2013-07-101-4/+9
| | | | | | | | This is probably not the final form of this change, but this is a preliminary version of checking a timestamp to see if the cached working directory HEAD OID matches the current. Right now, this uses the timestamp on the index and is, like most of our timestamp checking, subject to having only second accuracy.
* More diff submodule tests for cache issuesRussell Belfer2013-07-101-0/+150
| | | | | | | | | | | | | The submodules code caches data about submodules in a way that can cause problems. This adds some tests that try making various modifications to the state of a submodule to see where we can catch out problems in the submodule caching. Right now, I've put in an extra git_submodule_reload_all so that the test will pass, but with that commented out, the test fails. I'm working on fixing the broken version of the test at which point I'll commit the fix and delete the extra reload that makes the test pass.
* Fix diff test helper to show parent file/lineRussell Belfer2013-07-101-6/+13
|
* Fix memory leak in testRussell Belfer2013-07-101-0/+1
|
* More improvements to submodule diff testsRussell Belfer2013-07-101-5/+23
| | | | | | This controls for the diff.mnemonicprefix setting so that can't break the tests. Also, this expands one test to emulate an ObjectiveGit test more closely.
* Add another submodule test of dirty wdRussell Belfer2013-07-101-0/+39
|
* Add git_pathspec_match_diff APIRussell Belfer2013-07-101-0/+92
| | | | | | | | | | | | | | | | | | This adds an additional pathspec API that will match a pathspec against a diff object. This is convenient if you want to handle renames (so you need the whole diff and can't use the pathspec constraint built into the diff API) but still want to tell if the diff had any files that matched the pathspec. When the pathspec is matched against a diff, instead of keeping a list of filenames that matched, instead the API keeps the list of git_diff_deltas that matched and they can be retrieved via a new API git_pathspec_match_list_diff_entry. There are a couple of other minor API extensions here that were mostly for the sake of convenience and to reduce dependencies on knowing the internal data structure between files inside the library.
* Diff hunk context off by one on long linesRussell Belfer2013-07-052-2/+34
| | | | | | | | | | | The diff hunk context string that is returned to xdiff need not be NUL terminated because the xdiff code just copies the number of bytes that you report directly into the output. There was an off by one in the diff driver code when the header context was longer than the output buffer size, the output buffer length included the NUL byte which was copied into the hunk header. Fixes #1710
* Fix compilation warningsnulltoken2013-06-291-1/+1
|
* Fix bug marking submodule diffs as unmodifiedRussell Belfer2013-06-271-1/+3
| | | | | | | There was a bug where submodules whose HEAD had not been moved were being marked as having an UNMODIFIED delta record instead of being left MODIFIED. This fixes that and fixes the tests to notice if a submodule has been incorrectly marked as UNMODIFIED.
* Fail on unmodified deltas when they're unexpectedJustin Spahr-Summers2013-06-261-1/+1
|
* test-rename: This is not a decimal, sillyVicent Marti2013-06-251-2/+2
|