diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-03-25 00:25:43 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-03-25 00:25:43 +0100 |
commit | b6a7a06aa6f083f21b0fca2558c737324eda1602 (patch) | |
tree | 75032ee8528906017e5ef773733b590e29fbf2fa /diff.c | |
parent | Merge branch 'pb/log-first-parent-p-m' (diff) | |
parent | git status: ignoring untracked files must apply to submodules too (diff) | |
download | git-b6a7a06aa6f083f21b0fca2558c737324eda1602.tar.xz git-b6a7a06aa6f083f21b0fca2558c737324eda1602.zip |
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.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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 { |