|
61080a95
|
2013-11-05T15:10:02
|
|
Fix leaks
|
|
5a0b8803
|
2013-11-04T08:05:55
|
|
Merge pull request #1929 from libgit2/rb/misc-diff-fixes
Fix some observed problems with incorrect diffs
|
|
187009e2
|
2013-11-02T18:34:51
|
|
Fix a leak in the diff tests
|
|
3e57069e
|
2013-11-01T13:49:43
|
|
Fix --assume-unchanged support
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.
|
|
e7c85120
|
2013-11-01T11:39:37
|
|
More tests and fixed for merging reversed diffs
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.
|
|
a5c16f3c
|
2013-11-01T10:18:03
|
|
Add git_diff_options_init helper
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.
|
|
4bf630b6
|
2013-10-31T14:36:52
|
|
Make diff and status perform soft index reload
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.
|
|
5de4ec81
|
2013-10-21T15:36:38
|
|
Implement patience and minimal diff flags
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).
|
|
3b5f7954
|
2013-10-21T13:42:42
|
|
Create git_diff_line and extend git_diff_hunk
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.
|
|
10672e3e
|
2013-10-15T15:10:07
|
|
Diff API cleanup
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.
|
|
3ff1d123
|
2013-10-11T14:51:54
|
|
Rename diff objects and split patch.h
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.
|
|
867f7c9b
|
2013-10-08T16:59:59
|
|
Rename new fn to git_repository_reinit_filesystem
|
|
14997dc5
|
2013-10-08T12:45:43
|
|
More filemode cleanups for FAT on MacOS
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.
|
|
5173ea92
|
2013-10-04T16:32:16
|
|
Add git_repository_reset_filesystem and fix tests
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.
|
|
634f10f6
|
2013-09-24T10:11:20
|
|
Fix incorrect return code in crlf filter
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.
|
|
155fa234
|
2013-09-05T15:06:42
|
|
Add clar helper to create new commit from index
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.
|
|
8427757f
|
2013-09-13T12:32:45
|
|
Fixing up some win32 issues with autocrlf
|
|
d5b1866c
|
2013-09-13T09:26:26
|
|
Rearrange clar submodule cleanup code
|
|
27061b15
|
2013-09-05T10:25:16
|
|
Fix some newer GCC compiler warnings
|
|
cf94024c
|
2013-09-04T11:42:48
|
|
Update clar
|
|
17c7fbf6
|
2013-08-21T14:07:53
|
|
Split rewrites, status doesn't return rewrites
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".
|
|
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()
|