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

minor bug: git submodule update --init from a subdir shows wrong path

From
David Turner <novalis@novalis.org>
Date
Jan 6, 2017, 21:31 UTC
Message-ID
<1483738284.31165.6.camel@frank>

I believe (from bisection) that this was introduced in the transition to C at 3604242f080.

I've attached a repro (against master). At the time the bug was introduced, the output in question went to stdout instead of stderr, so the attached test case will not quite work on the older version. But if you run under -v, you'll be able to see the bad ("foo/foo/sub" instead of "foo/sub" or just "sub") output.

diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 64f322c..e1deb17 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -140,6 +140,23 @@ test_expect_success 'submodule update --init --recursive from subdirectory' '
 	test_i18ncmp expect2 actual2
 '
 
+cat <<EOF >expect2
+Submodule 'foo/sub' (/home/novalis/twosigma/git/t/trash directory.t7406-submodule-update/withsubs/../rebasing) registered for path 'foo/sub'
+EOF
+
+test_expect_success 'submodule update --init from and of subdirectory' '
+	git init withsubs &&
+	(cd withsubs &&
+	 mkdir foo &&
+	 git submodule add "$(pwd)/../rebasing" foo/sub &&
+	 (cd foo &&
+	  git submodule deinit -f sub &&
+	  git submodule update --init sub 2>../../actual2
+	 )
+	) &&
+	test_i18ncmp expect2 actual2
+'
+
 apos="'";
 test_expect_success 'submodule update does not fetch already present commits' '
 	(cd submodule &&
Message 1 of 1 in “minor bug: git submodule update --init from a subdir shows wrong path”
  1. David TurnerJan 6, 2017

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.