summaryrefslogtreecommitdiff
path: root/diff-lib.c
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2010-03-08 13:53:19 +0100
committerJunio C Hamano <gitster@pobox.com>2010-03-08 15:49:23 -0800
commit9297f77e6d350f33de961e149dc33c77e7392db4 (patch)
tree6ef83ac56865487414747ff0756fad64d9b3c7cc /diff-lib.c
parentc7e1a73641e24340bf93f6f1792220fa9154cda3 (diff)
downloadgit-9297f77e6d350f33de961e149dc33c77e7392db4.tar.gz
git status: Show detailed dirty status of submodules in long format
Since 1.7.0 there are three reasons a submodule is considered modified against the work tree: It contains new commits, modified content or untracked content. Lets show all reasons in the long format of git status, so the user can better asses the nature of the modification. This change does not affect the short and porcelain formats. Two new members are added to "struct wt_status_change_data" to store the information gathered by run_diff_files(). wt-status.c uses the new flag DIFF_OPT_DIRTY_SUBMODULES to tell diff-lib.c it wants to get detailed dirty information about submodules. A hint line for submodules is printed in the dirty header when dirty submodules are present. 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.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/diff-lib.c b/diff-lib.c
index 15ca7cdac2..1ab286a3ce 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -180,7 +180,8 @@ 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))) {
+ && (!changed || (revs->diffopt.output_format & DIFF_FORMAT_PATCH)
+ || DIFF_OPT_TST(&revs->diffopt, DIRTY_SUBMODULES))) {
dirty_submodule = is_submodule_modified(ce->name);
if (dirty_submodule)
changed = 1;
@@ -243,7 +244,8 @@ 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))) {
+ && (!changed || (diffopt->output_format & DIFF_FORMAT_PATCH)
+ || DIFF_OPT_TST(diffopt, DIRTY_SUBMODULES))) {
*dirty_submodule = is_submodule_modified(ce->name);
if (*dirty_submodule)
changed = 1;