aboutsummaryrefslogtreecommitdiffstats
path: root/diff-lib.c
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2010-03-04 22:20:33 +0100
committerJunio C Hamano <gitster@pobox.com>2010-03-04 22:16:33 -0800
commitc7e1a73641e24340bf93f6f1792220fa9154cda3 (patch)
treed414fd7b961223be35decfc3038342d63f2f4223 /diff-lib.c
parent5ce9086ddfe6931ef34fcd99778c9235e2ee1839 (diff)
downloadgit-c7e1a73641e24340bf93f6f1792220fa9154cda3.tar.gz
git diff --submodule: Show detailed dirty status of submodules
When encountering a dirty submodule while doing "git diff --submodule" print an extra line for new untracked content and another for modified but already tracked content. And if the HEAD of the submodule is equal to the ref diffed against in the superproject, drop the output which would just show the same SHA1s and no commit message headlines. To achieve that, the dirty_submodule bitfield is expanded to two bits. The output of "git status" inside the submodule is parsed to set the according bits. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff-lib.c')
-rw-r--r--diff-lib.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/diff-lib.c b/diff-lib.c
index d7e13cb177..15ca7cdac2 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -180,10 +180,10 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
changed = ce_match_stat(ce, &st, ce_option);
if (S_ISGITLINK(ce->ce_mode)
&& !DIFF_OPT_TST(&revs->diffopt, IGNORE_SUBMODULES)
- && (!changed || (revs->diffopt.output_format & DIFF_FORMAT_PATCH))
- && is_submodule_modified(ce->name)) {
- changed = 1;
- dirty_submodule = 1;
+ && (!changed || (revs->diffopt.output_format & DIFF_FORMAT_PATCH))) {
+ dirty_submodule = is_submodule_modified(ce->name);
+ if (dirty_submodule)
+ changed = 1;
}
if (!changed) {
ce_mark_uptodate(ce);
@@ -243,10 +243,10 @@ static int get_stat_data(struct cache_entry *ce,
changed = ce_match_stat(ce, &st, 0);
if (S_ISGITLINK(ce->ce_mode)
&& !DIFF_OPT_TST(diffopt, IGNORE_SUBMODULES)
- && (!changed || (diffopt->output_format & DIFF_FORMAT_PATCH))
- && is_submodule_modified(ce->name)) {
- changed = 1;
- *dirty_submodule = 1;
+ && (!changed || (diffopt->output_format & DIFF_FORMAT_PATCH))) {
+ *dirty_submodule = is_submodule_modified(ce->name);
+ if (*dirty_submodule)
+ changed = 1;
}
if (changed) {
mode = ce_mode_from_stat(ce, st.st_mode);