|
5e96f316
|
2013-08-08T08:54:38
|
|
Merge pull request #1738 from libgit2/diff-patch-content-size
Add API for getting at git_diff_patch->content_size
|
|
e8242022
|
2013-08-05T09:59:02
|
|
Move slow tests to "stress" clar module
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.
|
|
31b42eac
|
2013-08-04T14:09:44
|
|
Restore commented out tests
This restores the commented out tests (even though they're slow)
and fixes some trailing whitespace.
|
|
0a38eb42
|
2013-07-31T22:36:50
|
|
Rename test for rename from rewrite
A rename test that illustrates a rename from a rewrite.
|
|
a42c2a8c
|
2013-07-31T21:51:50
|
|
Rename test for multiple similar matches
A rename test that illustrates a source matching multiple targets.
|
|
d730d3f4
|
2013-07-31T16:40:42
|
|
Major rename detection changes
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.
|
|
a5140f4d
|
2013-07-24T17:11:49
|
|
Fix rename detection for tree-to-tree diffs
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.
|
|
397357a0
|
2013-07-24T13:12:00
|
|
Add rename test that used to be really slow
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.
|
|
197b8966
|
2013-07-23T14:34:31
|
|
Add hunk/file headers to git_diff_patch_size
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.
|
|
b4a4cf24
|
2013-07-22T16:07:56
|
|
Add git_diff_patch_size() API
This adds a new API to get the size in bytes of the diffs in a
git_diff_patch object.
|
|
d6cb13d7
|
2013-07-13T14:00:05
|
|
tests: Fix memory leak
|
|
584f2d30
|
2013-07-11T11:04:42
|
|
Fix warnings on Win64
|
|
125655fe
|
2013-07-02T16:49:57
|
|
Untracked directories with .git should be ignored
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
|
|
9564229a
|
2013-06-30T08:43:07
|
|
Add tests for diff.ignoreSubmdules config
|
|
f9775a37
|
2013-06-29T23:22:31
|
|
Add ignore_submodules to diff options
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.
|
|
2e3e273e
|
2013-06-29T13:20:45
|
|
Update diff to new internal submodule status API
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.
|
|
e807860f
|
2013-06-27T16:52:38
|
|
Add timestamp check to submodule status
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.
|
|
4535f044
|
2013-06-27T16:12:44
|
|
More diff submodule tests for cache issues
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.
|
|
3e7d7100
|
2013-06-27T16:12:00
|
|
Fix diff test helper to show parent file/line
|
|
49621a34
|
2013-06-27T15:46:46
|
|
Fix memory leak in test
|
|
12f8fe00
|
2013-06-27T15:43:12
|
|
More improvements to submodule diff tests
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.
|
|
0105b55e
|
2013-06-27T15:26:31
|
|
Add another submodule test of dirty wd
|
|
2b672d5b
|
2013-07-08T22:46:36
|
|
Add git_pathspec_match_diff API
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.
|
|
a5f9b5f8
|
2013-07-05T16:59:38
|
|
Diff hunk context off by one on long lines
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
|
|
c4ac556e
|
2013-06-29T12:48:58
|
|
Fix compilation warnings
|
|
c67ff958
|
2013-06-27T07:38:27
|
|
Fix bug marking submodule diffs as unmodified
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.
|
|
c7974b49
|
2013-06-26T12:03:33
|
|
Fail on unmodified deltas when they're unexpected
|
|
c0e58e43
|
2013-06-25T00:12:19
|
|
test-rename: This is not a decimal, silly
|
|
94ef2a35
|
2013-06-20T15:15:10
|
|
Add test for fixed diff bug
Add test for bug fixed in 852ded96982ae70acb63c3940fae08ea29e40fee
Sorry, I wrote that bug fix and forgot to check in a test at the
same time. Here is one that fails on the old version of the code
and now works.
|
|
e4acc3ba
|
2013-06-18T16:14:35
|
|
Fix rename looped reference issues
This makes the diff rename tracking code more careful about the
order in which it processes renames and more thorough in updating
the mapping of correct renames when an earlier rename update
alters the index of a later matched pair.
|
|
3b334075
|
2013-06-17T17:39:59
|
|
test illustrating tri-cyclic rename failure
|
|
f0f2ff9c
|
2013-06-17T17:33:40
|
|
test failure when renames produce similar similarities
|
|
74ded024
|
2013-06-17T17:03:34
|
|
Add "as_path" parameters to blob and buffer diffs
This adds parameters to the four functions that allow for blob-to-
blob and blob-to-buffer differencing (either via callbacks or by
making a git_diff_patch object). These parameters let you say
that filename we should pretend the blob has while doing the diff.
If you pass NULL, there should be no change from the existing
behavior, which is to skip using attributes for file type checks
and just look at content. With the parameters, you can plug into
the new diff driver functionality and get binary or non-binary
behavior, plus function context regular expressions, etc.
This commit also fixes things so that the git_diff_delta that is
generated by these functions will actually be populated with the
data that we know about the blobs (or buffers) so you can use it
appropriately. It also fixes a bug in generating patches from
the git_diff_patch objects created via these functions.
Lastly, there is one other behavior change that may matter. If
there is no difference between the two blobs, these functions no
longer generate any diff callbacks / patches unless you have
passed in GIT_DIFF_INCLUDE_UNMODIFIED. This is pretty natural,
but could potentially change the behavior of existing usage.
|
|
de0555a3
|
2013-06-17T09:55:29
|
|
Fix memory leaks in diff rename tests
This fixes a couple objects I forgot to free, and also updates
the valgrind suppressions file on the Mac to cover a few more
cases that had crept in.
|
|
f3b5bc83
|
2013-06-16T21:51:43
|
|
Add test of rename with no changes
A tree to index rename with no changes was getting erased by
the iteration routine (if the routine actually loaded the data
for the unmodified file). This invokes the code path that was
previously messing up the diff and iterates twice to make sure
that the iteration process itself doesn't modify the data.
|
|
6ea999bb
|
2013-06-13T15:52:12
|
|
Make index_insert keep existing case
In a case insensitive index, if you attempt to add a file from
disk with a different case pattern, the old case pattern in the
index should be preserved.
This fixes that (and a couple of minor warnings).
|
|
1540b199
|
2013-05-31T18:12:49
|
|
some simple case-sensitive index tests
|
|
519072c9
|
2013-06-14T14:02:00
|
|
diff: fix warning
|
|
88c401be
|
2013-06-12T14:54:32
|
|
Merge pull request #1643 from ethomson/rename_source
Keep data about source of similarity
|
|
f9c824c5
|
2013-06-12T11:55:27
|
|
Add patch from blobs API
This adds two new public APIs: git_diff_patch_from_blobs and
git_diff_patch_from_blob_and_buffer, plus it refactors the code
for git_diff_blobs and git_diff_blob_to_buffer so that they code
is almost entirely shared between these APIs, and adds tests for
the new APIs.
|
|
54faddd2
|
2013-06-12T11:54:11
|
|
Fix some diff driver memory leaks
|
|
42e6cf78
|
2013-06-11T17:45:14
|
|
Add diff drivers tests (and fix bugs)
This adds real tests for user-configured diff drivers and in the
process found a bunch of bugs.
|
|
5dc98298
|
2013-06-11T11:22:22
|
|
Implement regex pattern diff driver
This implements the loading of regular expression pattern lists
for diff drivers that search for function context in that way.
This also changes the way that diff drivers update options and
interface with xdiff APIs to make them a little more flexible.
|
|
bda3fbb1
|
2013-06-10T14:17:54
|
|
failing unit test for similar renames
|
|
114f5a6c
|
2013-06-10T10:10:39
|
|
Reorganize diff and add basic diff driver
This is a significant reorganization of the diff code to break it
into a set of more clearly distinct files and to document the new
organization. Hopefully this will make the diff code easier to
understand and to extend.
This adds a new `git_diff_driver` object that looks of diff driver
information from the attributes and the config so that things like
function content in diff headers can be provided. The full driver
spec is not implemented in the commit - this is focused on the
reorganization of the code and putting the driver hooks in place.
This also removes a few #includes from src/repository.h that were
overbroad, but as a result required extra #includes in a variety
of places since including src/repository.h no longer results in
pulling in the whole world.
|
|
cee695ae
|
2013-05-31T12:18:43
|
|
Make iterators use GIT_ITEROVER & smart advance
1. internal iterators now return GIT_ITEROVER when you go past the
last item in the iteration.
2. git_iterator_advance will "advance" to the first item in the
iteration if it is called immediately after creating the
iterator, which allows a simpler idiom for basic iteration.
3. if git_iterator_advance encounters an error reading data (e.g.
a missing tree or an unreadable file), it returns the error
but also attempts to advance past the invalid data to prevent
an infinite loop.
Updated all tests and internal usage of iterators to account for
these new behaviors.
|
|
49f70f2c
|
2013-05-23T15:48:06
|
|
Fill out diff rename test coverage
This extends the rename tests to make sure that every rename
scenario in the inner loop of git_diff_find_similar is actually
exercised. Also, fixes an incorrect assert that was in one of
the clauses that was not previously being exercised.
|
|
67db583d
|
2013-05-23T15:06:07
|
|
More diff rename tests; better split swap handling
This adds a couple more tests of different rename scenarios.
Also, this fixes a problem with the case where you have two
"split" deltas and the left half of one matches the right half of
the other. That case was already being handled, but in the wrong
order in a way that could result in bad output. Also, if the swap
also happened to put the other two halves into the correct place
(i.e. two files exchanged places with each other), then the second
delta was left with the SPLIT flag set when it really should be
cleared.
|
|
a21cbb12
|
2013-05-22T10:37:12
|
|
Significant rename detection rewrite
This flips rename detection around so instead of creating a
forward mapping from deltas to possible rename targets, instead
it creates a reverse mapping, looking at possible targets and
trying to find a source that they could have been renamed or
copied from. This is important because each output can only
have a single source, but a given source could map to multiple
outputs (in the form of COPIED records).
Additionally, this makes a couple of tweaks to the public rename
detection APIs, mostly renaming a couple of options that control
the behavior to make more sense and to be more like core Git.
I walked through the tests looking at the exact results and
updated the expectations based on what I saw. The new code is
different from the old because it cannot give some nonsense
results (like A was renamed to both B and C) which were part of
the outputs previously.
|
|
4742148d
|
2013-05-20T13:41:39
|
|
Add more diff rename detection tests
This adds a bunch more rename detection tests including checks
vs the working directory, the new exact match options, some more
whitespace variants, etc.
This also adds a git_futils_writebuffer helper function and uses
it in checkout. This is mainly added because I wanted an easy
way to write out a git_buf to disk inside my test code.
|
|
d958e37a
|
2013-05-17T17:21:45
|
|
Fix issues with git_diff_find_similar
There are a number of bugs in the rename code that only were
obvious when I started testing it against large old repos with
more complex patterns. (The code to do that testing is not ready
to merge with libgit2, but I do plan to add more thorough tests.)
This contains a significant number of changes and also tweaks the
public API slightly to make emulating core git easier.
Most notably, this separates the GIT_DIFF_FIND_AND_BREAK_REWRITES
flag into FIND_REWRITES (which adds a self-similarity score to
every modified file) and BREAK_REWRITES (which splits the modified
deltas into add/remove pairs in the diff list). When you do a raw
output of core git, rewrites show up as M090 or such, not at A and
D output, so I wanted to be able to emulate that.
Publicly, this also changes the flags to be uint16_t since we
don't need values out of that range.
Internally, this contains significant changes from a number of
small bug fixes (like using the wrong side of the diff to decide
if the object could be found in the ODB vs the workdir) to larger
issues about which files can and should be compared and how the
various edge cases of similarity scores should be treated.
Honestly, I don't think this is the last update that will have to
be made to this code, but I think this moves us closer to correct
behavior and I tried to document the code so it would be easier
to follow..
|
|
79ef3be4
|
2013-05-15T14:50:05
|
|
Fix diff crash when last item is untracked dir
When the last item in a diff was an untracked directory that only
contained ignored items, the loop to scan the contents would run
off the end of the iterator and dereference a NULL pointer. This
includes a test that reproduces the problem and a fix.
|
|
b4d33e46
|
2013-05-14T21:54:26
|
|
Fix some memory leaks
|
|
e9ba61f3
|
2013-05-10T09:32:42
|
|
Fix diff output for renames and copies
If you use rename detection, the renamed and copied files would
not show any text diffs because the function that decides if
data should be loaded didn't know which sides of the diff to
load for those cases.
This adds a test that looks at the patch generated for diff
entries that are COPIED or RENAMED.
|
|
c2f602f8
|
2013-05-07T07:15:39
|
|
Fix line numbering for patches with eofnl
When a patch contained an eofnl change (i.e. the last line either
gained or lost a newline), the oldno and newno line number values
for the lines in the last hunk of the patch were not useful. This
makes them behave in a more expected manner.
|
|
fd96f98e
|
2013-05-07T04:36:42
|
|
More tests for files with no newline at end
|
|
e35e2684
|
2013-05-07T04:32:17
|
|
Add GIT_DIFF_LINE_CONTEXT_EOFNL
This adds a new line origin constant for the special line that
is used when both files end without a newline.
In the course of writing the tests for this, I was having problems
with modifying a file but not having diff notice because it was
the same size and modified less than one second from the start of
the test, so I decided to start working on nanosecond timestamp
support. This commit doesn't contain the nanosecond support, but
it contains the reorganization of maybe_modified and the hooks so
that if the nanosecond data were being read by stat() (or rather
being copied by git_index_entry__init_from_stat), then the nsec
would be taken into account.
This new stuff could probably use some more tests, although there
is some amount of it here.
|
|
a66c4bc8
|
2013-04-29T02:57:01
|
|
More tests for diff untracked directories
This includes more tests for various scenarios when diff includes
an untracked directory in the workdir with contents either ignored
or not.
|
|
b1ff7004
|
2013-04-22T16:25:57
|
|
Improve diff config options handling
This makes diff use the cvar cache for config options where
possible, and also adds support for a number of other config
options to diff including "diff.context", "diff.ignoreSubmodules",
"diff.noprefix", "diff.mnemonicprefix", and "core.abbrev".
To make this natural, this involved a rearrangement of the code
that allocates the diff object vs. the code that initializes it
based on the combination of options passed in by the user and
read from the config.
This commit includes tests for most of these new options as well.
|
|
8842c75f
|
2013-04-03T22:30:07
|
|
What has science done.
|
|
1384b688
|
2013-04-19T13:00:12
|
|
Move some low-level repo fns to include/git2/sys
|
|
0d32f39e
|
2013-03-04T11:31:50
|
|
Notify '*' pathspec correctly when diffing
I also moved all tests related to notifying in their own file.
|
|
ad26434b
|
2013-04-09T14:52:32
|
|
Tests and more fixes for submodule diffs
This adds tests for diffs with submodules in them and (perhaps
unsurprisingly) requires further fixes to be made. Specifically,
this fixes:
- when considering if a submodule is dirty in the workdir, it was
being treated as dirty even if only the index was dirty.
- git_diff_patch_to_str (and git_diff_patch_print) were "printing"
the headers for files (and submodules) that were unmodified or
had no meaningful content.
- added comment to previous fix and removed unneeded parens.
|
|
ccfa6805
|
2013-03-25T23:58:40
|
|
Fix some diff ignores and submodule dirty workdir
This started out trying to look at the problems from issue #1425
and gradually grew to a broader set of fixes. There are two core
things fixed here:
1. When you had an ignore like "/bin" which is rooted at the top
of your tree, instead of immediately adding the "bin/" entry
as an ignored item in the diff, we were returning all of the
direct descendants of the directory as ignored items. This
changes things to immediately ignore the directory. Note that
this effects the behavior in test_status_ignore__subdirectories
so that we no longer exactly match core gits ignore behavior,
but the new behavior probably makes more sense (i.e. we now
will include an ignored directory inside an untracked directory
that we previously would have left off).
2. When a submodule only contained working directory changes, the
diff code was always considering it unmodified which was just
an outright bug. The HEAD SHA of the submodule matches the SHA
in the parent repo index, and since the SHAs matches, the diff
code was overwriting the actual status with UNMODIFIED.
These fixes broke existing tests test_diff_workdir__submodules and
test_status_ignore__subdirectories but looking it over, I actually
think the new results are correct and the old results were wrong.
@nulltoken had actually commented on the subdirectory ignore issue
previously.
I also included in the tests some debugging versions of the
shared iteration callback routines that print status or diff
information. These aren't used actively in the tests, but can be
quickly swapped in to test code to give a better picture of what
is being scanned in some of the complex test scenarios.
|
|
1098cfae
|
2013-03-22T14:52:29
|
|
Test fixes and cleanup
This fixes some places where the new tests were leaving the test
area in a bad state or were freeing data they should not free.
It also removes code that is extraneous to the core issue and
fixes an invalid SHA being looked up in one of the tests (which
was failing, but for the wrong reason).
|
|
b8acb775
|
2013-03-07T22:15:40
|
|
Added some tests for issue #1397
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
|
1323c6d1
|
2013-03-22T14:27:56
|
|
Add cl_repo_set_bool and cleanup tests
This adds a helper function for the cases where you want to
quickly set a single boolean config value for a repository.
This allowed me to remove a lot of code.
|
|
65025cb8
|
2013-03-18T17:24:13
|
|
Three submodule status bug fixes
1. Fix sort order problem with submodules where "mod" was sorting
after "mod-plus" because they were being sorted as "mod/" and
"mod-plus/". This involved pushing the "contains a .git entry"
test significantly lower in the stack.
2. Reinstate behavior that a directory which contains a .git entry
will be treated as a submodule during iteration even if it is
not yet added to the .gitmodules.
3. Now that any directory containing .git is reported as submodule,
we have to be more careful checking for GIT_EEXISTS when we
do a submodule lookup, because that is the error code that is
returned by git_submodule_lookup when you try to look up a
directory containing .git that has no record in gitmodules or
the index.
|
|
1ac10aae
|
2013-03-12T09:23:53
|
|
Merge pull request #1408 from arrbee/refactor-iterators
Refactor iterators
|
|
aa408cbf
|
2013-03-11T11:18:00
|
|
handle small files in similarity metrics
|
|
1aa5318a
|
2013-03-09T16:04:34
|
|
diff: allow asking for diffs with no context
Previously, 0 meant default. This is problematic, as asking for 0
context lines is a valid thing to do.
Change GIT_DIFF_OPTIONS_INIT to default to three and stop treating 0
as a magic value. In case no options are provided, make sure the
options in the diff object default to 3.
|
|
9bea03ce
|
2013-03-06T15:16:34
|
|
Add INCLUDE_TREES, DONT_AUTOEXPAND iterator flags
This standardizes iterator behavior across all three iterators
(index, tree, and working directory). Previously the working
directory iterator behaved differently from the other two.
Each iterator can now operate in one of three modes:
1. *No tree results, auto expand trees* means that only non-
tree items will be returned and when a tree/directory is
encountered, we will automatically descend into it.
2. *Tree results, auto expand trees* means that results will
be given for every item found, including trees, but you
only need to call normal git_iterator_advance to yield
every item (i.e. trees returned with pre-order iteration).
3. *Tree results, no auto expand* means that calling the
normal git_iterator_advance when looking at a tree will
not descend into the tree, but will skip over it to the
next entry in the parent.
Previously, behavior 1 was the only option for index and tree
iterators, and behavior 3 was the only option for workdir.
The main public API implications of this are that the
`git_iterator_advance_into()` call is now valid for all
iterators, not just working directory iterators, and all the
existing uses of working directory iterators explicitly use
the GIT_ITERATOR_DONT_AUTOEXPAND (for now).
Interestingly, the majority of the implementation was in the
index iterator, since there are no tree entries there and now
have to fake them. The tree and working directory iterators
only required small modifications.
|
|
169dc616
|
2013-03-05T16:10:05
|
|
Make iterator APIs consistent with standards
The iterator APIs are not currently consistent with the parameter
ordering of the rest of the codebase. This rearranges the order
of parameters, simplifies the naming of a number of functions, and
makes somewhat better use of macros internally to clean up the
iterator code.
This also expands the test coverage of iterator functionality,
making sure that case sensitive range-limited iteration works
correctly.
|
|
323bb885
|
2013-03-04T00:21:56
|
|
Fix a few leaks
`git_diff_get_patch()` would unconditionally load the patch object and
then simply leak it if the user hadn't requested it. Short-circuit
loading the object if the user doesn't want it.
The rest of the plugs are simply calling the free functions of objects
allocated during the tests.
|
|
487fc724
|
2013-03-01T13:41:53
|
|
Allow empty config object and use it
This removes assertions that prevent us from having an empty
git_config object and then updates some tests that were
dependent on global config state to use an empty config before
running anything.
|
|
7d46b34b
|
2013-03-01T12:26:05
|
|
Control for core.autocrlf during testing
|
|
e68e33f3
|
2013-02-27T14:50:32
|
|
Merge pull request #1233 from arrbee/file-similarity-metric
Add file similarity scoring to diff rename/copy detection
|
|
1be4ba98
|
2013-02-22T11:13:01
|
|
More rename detection tests
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.
|
|
7beeb3f4
|
2013-02-22T14:03:44
|
|
Rename 'exp' so it doesn't conflict with exp()
|
|
6f9d5ce8
|
2013-02-22T10:17:08
|
|
Fix tests for find_similar and related
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.
|
|
d4b747c1
|
2013-02-21T16:44:44
|
|
Add diff rename tests with partial similarity
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).
|
|
960a04dd
|
2013-02-21T12:40:33
|
|
Initial integration of similarity metric to diff
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.
|
|
71a3d27e
|
2013-02-08T10:06:47
|
|
Replace diff delta binary with flags
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.
|
|
fcd7733d
|
2013-02-14T12:49:46
|
|
Merge pull request #1318 from nulltoken/topic/diff-tree-coverage
Topic/diff tree coverage
|
|
c2c0874d
|
2013-02-11T14:44:56
|
|
More diff tests with binary data
|
|
390a3c81
|
2013-02-11T11:44:00
|
|
Merge pull request #1190 from nulltoken/topic/reset-paths
reset: Allow the selective reset of pathspecs
|
|
0d64ba48
|
2013-01-25T17:35:46
|
|
diff: add a notify callback to `git_diff__from_iterators`
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
|
|
e8993455
|
2012-08-15T20:08:09
|
|
diff: Enhance tree-to-tree diff test coverage
These tests are related to issue libgit2/libgit2sharp#196
|
|
7e858045
|
2013-02-06T16:06:17
|
|
diff: refactor git_diff_tree_to_tree() tests
|
|
3ad05221
|
2013-02-05T16:52:56
|
|
Fix MSVC compilation warnings
Fix #1308
|
|
3bf68be4
|
2013-01-30T11:25:20
|
|
Free buffer at end of test
|
|
f1e2735c
|
2013-01-30T11:10:39
|
|
Add helper for diff line stats
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.
|
|
cce548e3
|
2013-01-22T15:28:25
|
|
Fix case sensitivity bug with tree iterators
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.
|
|
25423d03
|
2013-01-09T16:07:54
|
|
Support case insensitive tree iterators and status
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.
|
|
a49340c3
|
2013-01-08T15:56:11
|
|
Test for ignore_case ranges on workdir iterator
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.
|
|
134d8c91
|
2013-01-08T15:53:13
|
|
Update iterator API with flags for ignore_case
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.
|
|
4b181037
|
2013-01-08T13:39:15
|
|
Minor iterator API cleanups
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
|
|
805c476c
|
2013-01-11T11:20:44
|
|
Fix diff patch line number calculation
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.
|
|
2086e1ba
|
2013-01-11T16:54:57
|
|
tests: plug a couple of leaks
|
|
de590550
|
2013-01-08T17:11:11
|
|
Resolve crash with diff against empty file
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
|