summaryrefslogtreecommitdiff
path: root/diff-lib.c
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2010-01-16 17:42:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-01-17 00:40:50 (GMT)
commitee6fc514f2df821c2719cc49499a56ef2fb136b0 (patch)
treef5aa79026dcad4897fbb0501027d70a5d8a48cd1 /diff-lib.c
parent1f73566af5bec28cd8489c6139a9ede95817349c (diff)
downloadgit-ee6fc514f2df821c2719cc49499a56ef2fb136b0.zip
git-ee6fc514f2df821c2719cc49499a56ef2fb136b0.tar.gz
git-ee6fc514f2df821c2719cc49499a56ef2fb136b0.tar.bz2
Show submodules as modified when they contain a dirty work tree
Until now a submodule only then showed up as modified in the supermodule when the last commit in the submodule differed from the one in the index or the diffed against commit of the superproject. A dirty work tree containing new untracked or modified files in a submodule was undetectable when looking at it from the superproject. Now git status and git diff (against the work tree) in the superproject will also display submodules as modified when they contain untracked or modified files, even if the compared ref matches the HEAD of the submodule. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff-lib.c')
-rw-r--r--diff-lib.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/diff-lib.c b/diff-lib.c
index 1c7e652..9cdf6da 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -10,6 +10,7 @@
#include "cache-tree.h"
#include "unpack-trees.h"
#include "refs.h"
+#include "submodule.h"
/*
* diff-files
@@ -159,7 +160,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
continue;
}
- if (ce_uptodate(ce) || ce_skip_worktree(ce))
+ if ((ce_uptodate(ce) && !S_ISGITLINK(ce->ce_mode)) || ce_skip_worktree(ce))
continue;
/* If CE_VALID is set, don't look at workdir for file removal */
@@ -176,6 +177,8 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
continue;
}
changed = ce_match_stat(ce, &st, ce_option);
+ if (S_ISGITLINK(ce->ce_mode) && !changed)
+ changed = is_submodule_modified(ce->name);
if (!changed) {
ce_mark_uptodate(ce);
if (!DIFF_OPT_TST(&revs->diffopt, FIND_COPIES_HARDER))
@@ -230,7 +233,8 @@ static int get_stat_data(struct cache_entry *ce,
return -1;
}
changed = ce_match_stat(ce, &st, 0);
- if (changed) {
+ if (changed
+ || (S_ISGITLINK(ce->ce_mode) && is_submodule_modified(ce->name))) {
mode = ce_mode_from_stat(ce, st.st_mode);
sha1 = null_sha1;
}