Commit Graph

17 Commits

Author SHA1 Message Date
Carlos Martín Nieto
ff47537557 diff: check files with the same or newer timestamps
When a file on the workdir has the same or a newer timestamp than the
index, we need to perform a full check of the contents, as the update of
the file may have happened just after we wrote the index.

The iterator changes are such that we can reach inside the workdir
iterator from the diff, though it may be better to have an accessor
instead of moving these structs into the header.
2015-06-22 12:47:30 +02:00
Carlos Martín Nieto
e44abe16bd tests: tick the index when we count OID calculations
These tests want to test that we don't recalculate entries which match
the index already. This is however something we force when truncating
racily-clean entries.

Tick the index forward as we know that we don't perform the
modifications which the racily-clean code is trying to avoid.
2015-06-16 08:51:45 +02:00
Edward Thomson
8147b1aff5 diff: introduce binary diff callbacks
Introduce a new binary diff callback to provide the actual binary
delta contents to callers.  Create this data from the diff contents
(instead of directly from the ODB) to support binary diffs including
the workdir, not just things coming out of the ODB.
2015-06-12 09:39:20 -04:00
Pierre-Olivier Latour
9f3c18e2ac Fixed build warnings on Xcode 6.1 2015-06-02 11:49:38 -07:00
Edward Thomson
b22369efa2 diff conflicts: test index to workdir w/ conflicts 2015-05-28 09:44:14 -04:00
Cha, Hojeong
3ac1ff42d7 Fix compile error on Visual Studio 2014-05-27 23:36:07 +09:00
Russell Belfer
8af4966db1 Git binary check compat tests
A variety of data patterns for diffs verified to match the
behavior of binary detection with Git on the command line.
2014-05-16 16:30:58 -07:00
Russell Belfer
9c8ed49997 Remove trace / add git_diff_perfdata struct + api 2014-05-02 09:21:33 -07:00
Russell Belfer
b23b112dfe Add payloads, bitmaps to trace API
This is a proposed adjustment to the trace APIs.  This makes the
trace levels into a bitmask so that they can be selectively enabled
and adds a callback-level payload, plus a message-level payload.

This makes it easier for me to a GIT_TRACE_PERF callbacks that
are simply bypassed if the PERF level is not set.
2014-05-02 09:21:33 -07:00
Russell Belfer
225aab5d6a Don't use trace if GIT_TRACE not defined 2014-05-02 09:21:33 -07:00
Russell Belfer
cd424ad551 Add GIT_STATUS_OPT_UPDATE_INDEX and use trace API
This adds an option to refresh the stat cache while generating
status.  It also rips out the GIT_PERF stuff I had an makes use
of the trace API to keep statistics about what happens during diff.
2014-05-02 09:21:33 -07:00
Russell Belfer
94fb4aadc8 Add diff option to update index stat cache
When diff is scanning the working directory, if it finds a file
where it is not sure if the index entry matches the working dir,
it will recalculate the OID (which is pretty expensive).  This
adds a new flag to diff so that if the OID calculation finds that
the file actually has not changed (i.e. just the modified time was
altered or such), then it will refresh the stat cache in the index
so that future calls to diff will not have to check the oid again.
2014-05-02 09:21:33 -07:00
Russell Belfer
8ef4e11a76 Skip diff oid calc when size definitely changed
When we think the stat cache in the index seems valid and the size
or mode of a file has definitely changed, then don't bother trying
to recalculate the OID of the workdir bits to confirm that it is
modified - just accept that it is modified.

This can result in files that show as modified with no actual diff,
but the behavior actually appears to match Git on the command line.

This also includes a minor optimization to not perform a submodule
lookup on the ".git" directory itself.
2014-05-02 09:21:32 -07:00
Russell Belfer
240f4af321 Add build option for diff internal statistics 2014-05-02 09:21:32 -07:00
Russell Belfer
d3bc95fd66 Update behavior for untracked sub-repos
When a directory containing a .git directory (or even just a plain
gitlink) was found, libgit2 was going out of its way to treat it
specially.  This seemed like it was necessary because the diff
code was not originally emulating Git's behavior for untracked
directories correctly (i.e. scanning for ignored vs untracked items
inside).  Now that libgit2 diff mimics Git's untracked directory
behavior, the special handling for contained Git repos is actually
incorrect and this commit rips it out.
2014-03-25 12:37:05 -07:00
Nicolas Hake
c05cd7924d Drop git_patch_to_str
It's hard or even impossible to correctly free the string buffer
allocated by git_patch_to_str in some circumstances. Drop the function
so people have to use git_patch_to_buf instead - git_buf has a dedicated
destructor.
2014-01-22 17:51:32 +01:00
Ben Straub
1782038144 Rename tests-clar to tests 2013-11-14 14:05:52 -08:00