Commit Graph

11 Commits

Author SHA1 Message Date
Russell Belfer
2e3e273e33 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.
2013-07-10 12:14:13 -07:00
Russell Belfer
e807860fa9 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.
2013-07-10 12:14:13 -07:00
Russell Belfer
4535f04409 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.
2013-07-10 12:14:12 -07:00
Russell Belfer
3e7d7100e2 Fix diff test helper to show parent file/line 2013-07-10 12:14:12 -07:00
Russell Belfer
49621a34af Fix memory leak in test 2013-07-10 12:14:12 -07:00
Russell Belfer
12f8fe0054 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.
2013-07-10 12:14:12 -07:00
Russell Belfer
0105b55e8f Add another submodule test of dirty wd 2013-07-10 12:14:12 -07:00
Russell Belfer
c67ff958c4 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.
2013-06-27 07:38:27 -07:00
Justin Spahr-Summers
c7974b49d0 Fail on unmodified deltas when they're unexpected 2013-06-26 12:03:33 -07:00
Russell Belfer
114f5a6c41 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.
2013-06-10 10:10:39 -07:00
Russell Belfer
ad26434b3b 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.
2013-04-09 14:52:32 -07:00