summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-03-24 23:25:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-03-24 23:25:43 (GMT)
commitb6a7a06aa6f083f21b0fca2558c737324eda1602 (patch)
tree75032ee8528906017e5ef773733b590e29fbf2fa /diff.c
parent797d44343c831680aeae3392259fcadeb178bf61 (diff)
parent3bfc45047654c7dd38b32033321228e97fc8f60e (diff)
downloadgit-b6a7a06aa6f083f21b0fca2558c737324eda1602.zip
git-b6a7a06aa6f083f21b0fca2558c737324eda1602.tar.gz
git-b6a7a06aa6f083f21b0fca2558c737324eda1602.tar.bz2
Merge branch 'jl/submodule-diff-dirtiness'
* jl/submodule-diff-dirtiness: git status: ignoring untracked files must apply to submodules too git status: Fix false positive "new commits" output for dirty submodules Refactor dirty submodule detection in diff-lib.c git status: Show detailed dirty status of submodules in long format git diff --submodule: Show detailed dirty status of submodules
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/diff.c b/diff.c
index dfdfa1a..f5d93e9 100644
--- a/diff.c
+++ b/diff.c
@@ -2032,7 +2032,7 @@ static int diff_populate_gitlink(struct diff_filespec *s, int size_only)
char *data = xmalloc(100), *dirty = "";
/* Are we looking at the work tree? */
- if (!s->sha1_valid && s->dirty_submodule)
+ if (s->dirty_submodule)
dirty = "-dirty";
len = snprintf(data, 100,
@@ -2628,6 +2628,12 @@ int diff_setup_done(struct diff_options *options)
*/
if (options->pickaxe)
DIFF_OPT_SET(options, RECURSIVE);
+ /*
+ * When patches are generated, submodules diffed against the work tree
+ * must be checked for dirtiness too so it can be shown in the output
+ */
+ if (options->output_format & DIFF_FORMAT_PATCH)
+ DIFF_OPT_SET(options, DIRTY_SUBMODULES);
if (options->detect_rename && options->rename_limit < 0)
options->rename_limit = diff_rename_limit_default;
@@ -3086,7 +3092,8 @@ int diff_unmodified_pair(struct diff_filepair *p)
* dealing with a change.
*/
if (one->sha1_valid && two->sha1_valid &&
- !hashcmp(one->sha1, two->sha1))
+ !hashcmp(one->sha1, two->sha1) &&
+ !one->dirty_submodule && !two->dirty_submodule)
return 1; /* no change */
if (!one->sha1_valid && !two->sha1_valid)
return 1; /* both look at the same file on the filesystem. */
@@ -3221,6 +3228,8 @@ static void diff_resolve_rename_copy(void)
}
else if (hashcmp(p->one->sha1, p->two->sha1) ||
p->one->mode != p->two->mode ||
+ p->one->dirty_submodule ||
+ p->two->dirty_submodule ||
is_null_sha1(p->one->sha1))
p->status = DIFF_STATUS_MODIFIED;
else {