git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] git submodule: ignore dirty submodules for summary and status

From
Jens Lehmann <jens.lehmann@web.de>
Date
Jun 25, 2010, 14:56 UTC
Message-ID
<4C24C382.6030900@web.de>
In-Reply-To
<4C24C34B.20403@web.de>

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 <Jens.Lehmann@web.de>
---
 git-submodule.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 8c562a7..d9950c2 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -580,7 +580,7 @@ cmd_summary() {

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

 	test -z "$modules" && return

-	git $diff_cmd $cached --raw $head -- $modules |
+	git $diff_cmd $cached --ignore-submodules=dirty --raw $head -- $modules |
 	sane_egrep '^:([0-7]* )?160000' |
 	cut -c2- |
 	while read mod_src mod_dst sha1_src sha1_dst status name
@@ -760,7 +760,7 @@ cmd_status()
 			continue;
 		fi
 		set_name_rev "$path" "$sha1"
-		if git diff-files --quiet -- "$path"
+		if git diff-files --ignore-submodules=dirty --quiet -- "$path"
 		then
 			say " $sha1 $displaypath$revname"
 		else
-- 
1.7.1.757.g0ad3c.dirty
Previous: Jens LehmannNext: Jens Lehmann
Message 2 of 12 in “Teach "git status" the "--ignore-submodules" option”
  1. 0/2 Teach "git status" the "--ignore-submodules" optionJens Lehmann, Jun 25, 2010
  2. 1/2 git submodule: ignore dirty submodules for summary and statusJens Lehmann, Jun 25, 2010
  3. 2/2 Add the option "--ignore-submodules" to "git status"Jens Lehmann, Jun 25, 2010
  4. Junio C HamanoJun 25, 2010
  5. git-gui and gitk-git as submodules (Re: [RFC PATCH 0/2] Teach "git status" the "--ignore-submodules" option)Jonathan Nieder, Jun 25, 2010
  6. Tay Ray ChuanJun 26, 2010
  7. Jens LehmannJun 26, 2010
  8. Jonathan NiederJun 26, 2010
  9. Jens LehmannJun 28, 2010
  10. Marc BranchaudJun 28, 2010
  11. Jens LehmannJun 28, 2010
  12. Marc BranchaudJun 28, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.