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

[PATCH 2/2] submodule: warn about non-submodules

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 7, 2009, 13:43 UTC
Message-ID
<4392cb2a9f5f3283d6505e17ddcb36a6b427fbcf.1234013924u.git.johannes.schindelin@gmx.de>
In-Reply-To
<7vfxiqy76k.fsf@gitster.siamese.dyndns.org>
Earlier, when you called
        git submodule some/bogus/path

Git would silently ignore the path, without warning the user about the likely mistake. Now it does.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 git-submodule.sh           |    2 +-
 t/t7400-submodule-basic.sh |    7 +++++++
 2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 2f47e06..6cc2d33 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -59,7 +59,7 @@ resolve_relative_url ()
 #
 module_list()
 {
-	git ls-files --stage -- "$@" | grep '^160000 '
+	git ls-files --error-unmatch --stage -- "$@" | grep '^160000 '
 }
 
 #
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index a74f24c..b8cb2df 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -240,4 +240,11 @@ test_expect_success 'ls-files gracefully handles trailing slash' '
 
 '
 
+test_expect_success 'submodule <invalid-path> warns' '
+
+	git submodule no-such-submodule 2> output.err &&
+	grep "^error: .*no-such-submodule" output.err
+
+'
+
 test_done
-- 
1.6.1.2.630.g01a7e
Previous: Johannes Schindelin
Message 8 of 8 in “submodule: handle trailing slash, warn about non-submodules”
  1. submodule: handle trailing slash, warn about non-submodulesJohannes Schindelin, Feb 6, 2009
  2. Junio C HamanoFeb 6, 2009
  3. Johannes SchindelinFeb 6, 2009
  4. Junio C HamanoFeb 7, 2009
  5. 0/2 submodule path handling fixesJohannes Schindelin, Feb 7, 2009
  6. Junio C HamanoFeb 7, 2009
  7. 1/2 Let ls-files strip trailing slashes in submodules' pathsJohannes Schindelin, Feb 7, 2009
  8. 2/2 submodule: warn about non-submodulesJohannes Schindelin, Feb 7, 2009

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.