Skip to content

Commit 1807650

Browse files
jlehmanngitster
authored andcommitted
git submodule: ignore dirty submodules for summary and status
The summary and status commands only care about submodule commits, so it is rather pointless that they check for dirty work trees. This saves the time needed to scan the submodules work tree. Even "git status" profits from these savings when the status.submodulesummary config option is set, as this lead to traversing the submodule work trees twice, once for status and once again for the submodule summary. And if the submodule was just dirty, submodule summary produced rather meaningless output anyway: * sub 1234567...1234567 (0): Signed-off-by: Jens Lehmann <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6ed7dda commit 1807650

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

git-submodule.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ cmd_summary() {
578578

579579
cd_to_toplevel
580580
# Get modified modules cared by user
581-
modules=$(git $diff_cmd $cached --raw $head -- "$@" |
581+
modules=$(git $diff_cmd $cached --ignore-submodules=dirty --raw $head -- "$@" |
582582
sane_egrep '^:([0-7]* )?160000' |
583583
while read mod_src mod_dst sha1_src sha1_dst status name
584584
do
@@ -592,7 +592,7 @@ cmd_summary() {
592592

593593
test -z "$modules" && return
594594

595-
git $diff_cmd $cached --raw $head -- $modules |
595+
git $diff_cmd $cached --ignore-submodules=dirty --raw $head -- $modules |
596596
sane_egrep '^:([0-7]* )?160000' |
597597
cut -c2- |
598598
while read mod_src mod_dst sha1_src sha1_dst status name
@@ -758,7 +758,7 @@ cmd_status()
758758
continue;
759759
fi
760760
set_name_rev "$path" "$sha1"
761-
if git diff-files --quiet -- "$path"
761+
if git diff-files --ignore-submodules=dirty --quiet -- "$path"
762762
then
763763
say " $sha1 $displaypath$revname"
764764
else

0 commit comments

Comments
 (0)