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

[PATCH v2] submodule: prevent warning in summary output

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Aug 20, 2013, 00:26 UTC
Message-ID
<1376958397-800967-1-git-send-email-sandals@crustytoothpaste.net>

When git submodule summary is run and there is a deleted submodule, there is an warning from git rev-parse:

  fatal: Not a git repository: '.vim/pathogen/.git'

Silence this warning, since it is fully expected that a deleted submodule will not be a git repository.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---

I hesitated to add the test for $status because it will end up having no effect since we exclude that case later. However, for correctness, I included it.

 git-submodule.sh | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/git-submodule.sh b/git-submodule.sh
index 2979197..eec3135 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -1070,7 +1070,10 @@ cmd_summary() {
 		missing_src=
 		missing_dst=
 
+		test $status = D && missing_src=t
+
 		test $mod_src = 160000 &&
+		test -e "$name/.git" &&
 		! GIT_DIR="$name/.git" git-rev-parse -q --verify $sha1_src^0 >/dev/null &&
 		missing_src=t
 
-- 
1.8.4.rc3
Next: Chris Packham
Message 1 of 3 in “submodule: prevent warning in summary output”
  1. submodule: prevent warning in summary outputbrian m. carlson, Aug 20, 2013
  2. Chris PackhamAug 26, 2013
  3. Jens LehmannAug 26, 2013

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.