diff options
author | Russell Belfer <rb@github.com> | 2013-04-09 14:52:32 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-04-09 14:52:32 -0700 |
commit | ad26434b3b8a5eafab8ec52b83aa99beaf48fb03 (patch) | |
tree | ad5caff8bd3574a31040beaf1739f3ba3b6c8d9e /src/diff.c | |
parent | 9da187e83d1b8ab513a43fd54a9fe2be11b1703f (diff) | |
download | libgit2-ad26434b3b8a5eafab8ec52b83aa99beaf48fb03.tar.gz |
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.
Diffstat (limited to 'src/diff.c')
-rw-r--r-- | src/diff.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/diff.c b/src/diff.c index 7152683e7..37c89f3f1 100644 --- a/src/diff.c +++ b/src/diff.c @@ -542,7 +542,11 @@ static int maybe_modified( unsigned int sm_status = 0; if (git_submodule_status(&sm_status, sub) < 0) return -1; - status = GIT_SUBMODULE_STATUS_IS_UNMODIFIED(sm_status) + + /* check IS_WD_UNMODIFIED because this case is only used + * when the new side of the diff is the working directory + */ + status = GIT_SUBMODULE_STATUS_IS_WD_UNMODIFIED(sm_status) ? GIT_DELTA_UNMODIFIED : GIT_DELTA_MODIFIED; /* grab OID while we are here */ |