|
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
|
|
f2b7f7a6
|
2013-01-07T15:44:22
|
|
Share git_diff_blobs/git_diff_blob_to_buffer code
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.
|
|
d5cf4665
|
2012-12-19T08:04:31
|
|
Fix some leaks and (possibly) dangling pointers in tests
Also adds some asserts.
|
|
e62171e2
|
2012-12-17T11:10:25
|
|
Merge pull request #1151 from arrbee/fix-diff-constructor-names
Fix diff constructor names
|
|
56c72b75
|
2012-12-17T11:00:53
|
|
Fix diff constructor name order confusion
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
|
|
a3337f10
|
2012-12-17T15:15:20
|
|
blob: introduce git_blob_is_binary()
|
|
91e7d263
|
2012-12-10T15:29:44
|
|
Fix iterator reset and add reset ranges
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.
|
|
9950d27a
|
2012-12-06T13:26:58
|
|
Clean up iterator APIs
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.
|
|
0ab3a2ab
|
2012-11-30T20:34:50
|
|
Deploy GIT_INIT_STRUCTURE
|
|
ca901e7b
|
2012-11-29T15:16:19
|
|
Deploy GIT_DIFF_FIND_OPTIONS_INIT
|
|
2f8d30be
|
2012-11-29T15:05:04
|
|
Deploy GIT_DIFF_OPTIONS_INIT
|
|
e2934db2
|
2012-11-29T02:05:46
|
|
Merge pull request #1090 from arrbee/ignore-invalid-by-default
Ignore invalid entries by default
|
|
59a0d772
|
2012-11-27T20:24:56
|
|
diff: enhance test coverage against the workdir
|
|
a8122b5d
|
2012-11-21T15:39:03
|
|
Fix warnings on Win64 build
|
|
793c4385
|
2012-11-20T16:36:06
|
|
Update diff callback param order
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.
|
|
cfbe4be3
|
2012-11-17T19:54:47
|
|
More external API cleanup
Conflicts:
src/branch.c
tests-clar/refs/branches/create.c
|
|
9094d30b
|
2012-11-23T11:41:56
|
|
Reset all static variables to NULL in clar's __cleanup
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
|
|
d46b0a04
|
2012-11-19T16:34:44
|
|
Improve iterator ignoring .git file
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.
|
|
bbe6dbec
|
2012-11-14T23:29:48
|
|
Add explicit git_index ptr to diff and checkout
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.
|
|
bad68c0a
|
2012-11-13T14:02:59
|
|
Add iterator for git_index object
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).
|
|
5735bf5e
|
2012-11-13T13:58:29
|
|
Fix diff API to better parameter order
The diff API is not in the parameter order one would expect from
other libgit2 APIs. This fixes that.
|
|
1362a983
|
2012-11-02T10:00:28
|
|
Merge pull request #1014 from arrbee/diff-rename-detection
Initial implementation of diff rename detection
|
|
db106d01
|
2012-10-30T09:40:50
|
|
Move rename detection into new file
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.
|
|
93cf7bb8
|
2012-10-24T20:56:32
|
|
Add git_diff_patch_to_str API
This adds an API to generate a complete single-file patch text
from a git_diff_patch object.
|
|
b4f5bb07
|
2012-10-23T16:40:51
|
|
Initial implementation of diff rename detection
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.
|
|
c2e43fb1
|
2012-10-18T16:50:55
|
|
diff: workdir diffing in a bare repo returns EBAREREPO
|
|
4c47a8bc
|
2012-10-17T14:14:51
|
|
Merge pull request #968 from arrbee/diff-support-typechange
Support TYPECHANGE records in status and adjust checkout accordingly
|
|
52032ae5
|
2012-10-15T12:48:43
|
|
Fix single-file ignore checks
To answer if a single given file should be ignored, the path to
that file has to be processed progressively checking that there
are no intermediate ignored directories in getting to the file
in question. This enables that, fixing the broken old behavior,
and adds tests to exercise various ignore situations.
|
|
0d64bef9
|
2012-10-05T15:56:57
|
|
Add complex checkout test and then fix checkout
This started as a complex new test for checkout going through the
"typechanges" test repository, but that revealed numerous issues
with checkout, including:
* complete failure with submodules
* failure to create blobs with exec bits
* problems when replacing a tree with a blob because the tree
"example/" sorts after the blob "example" so the delete was
being processed after the single file blob was created
This fixes most of those problems and includes a number of other
minor changes that made it easier to do that, including improving
the TYPECHANGE support in diff/status, etc.
|
|
5d1308f2
|
2012-10-08T15:19:00
|
|
Add test for diffs with submodules and bug fixes
The adds a test for the submodule diff capabilities and then
fixes a few bugs with how the output is generated. It improves
the accuracy of OIDs in the diff delta object and makes the
submodule output more closely mirror the OIDs that will be used
by core git.
|
|
71966e2f
|
2012-10-08T15:18:30
|
|
Extend diff helpers for tests a little
|
|
cc5bf359
|
2012-09-28T09:08:09
|
|
Clean up Win64 warnings
|
|
bae957b9
|
2012-09-25T16:31:46
|
|
Add const to all shared pointers in diff API
There are a lot of places where the diff API gives the user access
to internal data structures and many of these were being exposed
through non-const pointers. This replaces them all with const
pointers for any object that the user can access but is still
owned internally to the git_diff_list or git_diff_patch objects.
This will probably break some bindings... Sorry!
|
|
64286308
|
2012-09-25T10:48:50
|
|
Fix bugs in new diff patch code
This fixes all the bugs in the new diff patch code. The only
really interesting one is that when we merge two diffs, we now
have to actually exclude diff delta records that are not supposed
to be tracked, as opposed to before where they could be included
because they would be skipped silently by `git_diff_foreach()`.
Other than that, there are just minor errors.
|
|
5f69a31f
|
2012-09-24T20:52:34
|
|
Initial implementation of new diff patch API
Replacing the `git_iterator` object, this creates a simple API
for accessing the "patch" for any file pair in a diff list and
then gives indexed access to the hunks in the patch and the lines
in the hunk. This is the initial implementation of this revised
API - it is still broken, but at least builds cleanly.
|
|
49d34c1c
|
2012-09-13T13:17:38
|
|
Fix problems in diff iterator record chaining
There is a bug in building the linked list of line records in the
diff iterator and also an off by one element error in the hunk
counts. This fixes both of these, adds some test data with more
complex sets of hunk and line diffs to exercise this code better.
|
|
1f35e89d
|
2012-09-11T12:03:33
|
|
Fix diff binary file detection
In the process of adding tests for the max file size threshold
(which treats files over a certain size as binary) there seem to
be a number of problems in the new code with detecting binaries.
This should fix those up, as well as add a test for the file
size threshold stuff.
Also, this un-deprecates `GIT_DIFF_LINE_ADD_EOFNL`, since I
finally found a legitimate situation where it would be returned.
|
|
b36effa2
|
2012-09-10T09:59:14
|
|
Replace git_diff_iterator_num_files with progress
The `git_diff_iterator_num_files` API was problematic, since we
don't actually know the exact number of files to be iterated over
until we load those files into memory. This replaces it with a
new `git_diff_iterator_progress` API that goes from 0 to 1, and
moves and renamed the old API for the internal places that can
tolerate a max value instead of an exact value.
|
|
f335ecd6
|
2012-08-30T14:24:16
|
|
Diff iterators
This refactors the diff output code so that an iterator object
can be used to traverse and generate the diffs, instead of just
the `foreach()` style with callbacks. The code has been rearranged
so that the two styles can still share most functions.
This also replaces `GIT_REVWALKOVER` with `GIT_ITEROVER` and uses
that as a common error code for marking the end of iteration when
using a iterator style of object.
|
|
5fdc41e7
|
2012-08-22T13:57:57
|
|
Minor bug fixes in diff code
In looking at PR #878, I found a few small bugs in the diff code,
mostly related to work that can be avoided when processing tree-
to-tree diffs that was always being carried out. This commit has
some small fixes in it.
|
|
51e1d808
|
2012-08-06T12:41:08
|
|
Merge remote-tracking branch 'arrbee/tree-walk-fixes' into development
Conflicts:
src/notes.c
src/transports/git.c
src/transports/http.c
src/transports/local.c
tests-clar/odb/foreach.c
|
|
5dca2010
|
2012-08-03T17:08:01
|
|
Update iterators for consistency across library
This updates all the `foreach()` type functions across the library
that take callbacks from the user to have a consistent behavior.
The rules are:
* A callback terminates the loop by returning any non-zero value
* Once the callback returns non-zero, it will not be called again
(i.e. the loop stops all iteration regardless of state)
* If the callback returns non-zero, the parent fn returns GIT_EUSER
* Although the parent returns GIT_EUSER, no error will be set in
the library and `giterr_last()` will return NULL if called.
This commit makes those changes across the library and adds tests
for most of the iteration APIs to make sure that they follow the
above rules.
|
|
b8457baa
|
2012-07-24T07:57:58
|
|
portability: Improve x86/amd64 compatibility
|
|
71d27358
|
2012-07-19T10:23:45
|
|
Fix bug with merging diffs with null options
A diff that is created with a NULL options parameter could result
in a NULL prefix string, but diff merge was unconditionally
strdup'ing it. I added a test to replicate the issue and then a
new method that does the right thing with NULL values.
|
|
29f9186d
|
2012-07-02T11:18:01
|
|
diff: make inter-hunk-context default value git-compliant
Default in git core is 0, not 3
|
|
cdca82c7
|
2012-06-20T00:46:26
|
|
Plug a few leaks
|
|
145e696b
|
2012-06-08T11:56:24
|
|
Minor fixes, cleanups, and clarifications
There are three actual changes in this commit:
1. When the trailing newline of a file is removed in a diff, the
change will now be reported with `GIT_DIFF_LINE_DEL_EOFNL` passed
to the callback. Previously, the `ADD_EOFNL` constant was given
which was just an error in my understanding of when the various
circumstances arose. `GIT_DIFF_LINE_ADD_EOFNL` is deprecated and
should never be generated. A new newline is simply an `ADD`.
2. Rewrote the `diff_delta__merge_like_cgit` function that contains
the core logic of the `git_diff_merge` implementation. The new
version doesn't actually have significantly different behavior,
but the logic should be much more obvious, I think.
3. Fixed a bug in `git_diff_merge` where it freed a string pool
while some of the string data was still in use. This led to
`git_diff_print_patch` accessing memory that had been freed.
The rest of this commit contains improved documentation in `diff.h`
to make the behavior and the equivalencies with core git clearer,
and a bunch of new tests to cover the various cases, oh and a minor
simplification of `examples/diff.c`.
|
|
0abd7244
|
2012-06-04T16:17:41
|
|
Fix filemode comparison in diffs
File modes were both not being ignored properly on platforms
where they should be ignored, nor be diffed consistently on
platforms where they are supported.
This change adds a number of diff and status filemode change
tests. This also makes sure that filemode-only changes are
included in the diff output when they occur and that filemode
changes are ignored successfully when core.filemode is false.
There is no code that automatically toggles core.filemode
based on the capabilities of the current platform, so the user
still needs to be careful in their .git/config file.
|
|
8e60c712
|
2012-06-07T09:50:19
|
|
Fix git_status_file for files that start with a character > 0x7f
git_status_file would always return GIT_ENOTFOUND for these files.
The underlying bug was that git__strcmp_cb, which is used by
git_path_with_stat_cmp to sort entries in the working directory,
compares strings based on unsigned chars (this is confirmed by the
strcmp(3) manpage), while git__prefixcmp, which is used by
workdir_iterator__entry_cmp to search for a path in the working
directory, compares strings based on char. So the sort puts this path at
the end of the list, while the search expects it to be at the beginning.
The fix was simply to make git__prefixcmp compare using unsigned chars,
just like strcmp(3). The rest of the change is just adding/updating
tests.
|
|
41a82592
|
2012-05-15T14:17:39
|
|
Ranged iterators and rewritten git_status_file
The goal of this work is to rewrite git_status_file to use the
same underlying code as git_status_foreach.
This is done in 3 phases:
1. Extend iterators to allow ranged iteration with start and
end prefixes for the range of file names to be covered.
2. Improve diff so that when there is a pathspec and there is
a common non-wildcard prefix of the pathspec, it will use
ranged iterators to minimize excess iteration.
3. Rewrite git_status_file to call git_status_foreach_ext
with a pathspec that covers just the one file being checked.
Since ranged iterators underlie the status & diff implementation,
this is actually fairly efficient. The workdir iterator does
end up loading the contents of all the directories down to the
single file, which should ideally be avoided, but it is pretty
good.
|
|
1956693f
|
2012-05-09T21:14:49
|
|
Fix MSVC compilation issue
exp() is already defined in math.h. This leads to LMSVC complaining
..\..\libgit2\tests-clar\diff\blob.c(5): error C2365: 'exp' : redefinition; previous definition was 'function'
Renaming the variable fixes this issue.
|
|
b470019f
|
2012-05-09T18:01:23
|
|
tests-clar/diff: fix missing-prototype warning
|
|
9a29f8d5
|
2012-05-04T07:55:09
|
|
diff: fix the diffing of two identical blobs
|
|
28ef7f9b
|
2012-05-03T17:25:01
|
|
diff: make git_diff_blobs() able to detect binary blobs
|
|
4f806761
|
2012-05-03T17:19:06
|
|
diff: fix the diffing of a concrete blob against a null one
|
|
245c5eae
|
2012-05-03T16:34:02
|
|
diff: When diffing two blobs, ensure the delta callback parameter is filled with relevant information
|
|
b709e951
|
2012-05-04T11:06:12
|
|
Fix memory leaks and use after free
|
|
f917481e
|
2012-05-03T16:37:25
|
|
Support reading attributes from index
Depending on the operation, we need to consider gitattributes
in both the work dir and the index. This adds a parameter to
all of the gitattributes related functions that allows user
control of attribute reading behavior (i.e. prefer workdir,
prefer index, only use index).
This fix also covers allowing us to check attributes (and
hence do diff and status) on bare repositories.
This was a somewhat larger change that I hoped because it had
to change the cache key used for gitattributes files.
|