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

[PATCH 2/2] submodule sync: Test we can pass individual submodules

From
Stefan Beller <sbeller@google.com>
Date
Feb 26, 2016, 20:51 UTC
Message-ID
<1456519912-10641-3-git-send-email-sbeller@google.com>
In-Reply-To
<1456519912-10641-1-git-send-email-sbeller@google.com>

The parent patch made changes to the way `git submodule--helper list` is called. From experience this is a sensitive topic and lots subtle things can go wrong. As all submodule subcommands except `sync` are setup to run `git submodule--helper list` in the original directory, I suspected a possible breakage in `sync` not being able to specify an exact submodule to run in, so let's add a test for that. Instead of adding a complete new test we can modify an existing test to additionally test the additional assertion of having just one submodule work fine.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 t/t7403-submodule-sync.sh | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/t/t7403-submodule-sync.sh b/t/t7403-submodule-sync.sh
index 79bc135..5dde123 100755
--- a/t/t7403-submodule-sync.sh
+++ b/t/t7403-submodule-sync.sh
@@ -28,6 +28,9 @@ test_expect_success setup '
 		git submodule add ../submodule submodule &&
 		test_tick &&
 		git commit -m "submodule"
+		git submodule add ../submodule submodule2 &&
+		test_tick &&
+		git commit -m "second submodule"
 	) &&
 	git clone super super-clone &&
 	(
@@ -149,15 +152,16 @@ test_expect_success 'reset submodule URLs' '
 	reset_submodule_urls super-clone
 '
 
-test_expect_success '"git submodule sync" should update submodule URLs - subdirectory' '
+test_expect_success '"git submodule sync" should update specified submodule URLs - subdirectory' '
 	(
 		cd super-clone &&
 		git pull --no-recurse-submodules &&
 		mkdir -p sub &&
 		cd sub &&
-		git submodule sync >../../output
+		git submodule sync ../submodule >../../output
 	) &&
 	grep "\\.\\./submodule" output &&
+	! grep submodule2 output &&
 	test -d "$(
 		cd super-clone/submodule &&
 		git config remote.origin.url
@@ -177,7 +181,7 @@ test_expect_success '"git submodule sync" should update submodule URLs - subdire
 	)
 '
 
-test_expect_success '"git submodule sync --recursive" should update all submodule URLs - subdirectory' '
+test_expect_success '"git submodule sync --recursive" should update all specified submodule URLs - subdirectory' '
 	(
 		cd super-clone &&
 		(
@@ -186,9 +190,10 @@ test_expect_success '"git submodule sync --recursive" should update all submodul
 		) &&
 		mkdir -p sub &&
 		cd sub &&
-		git submodule sync --recursive >../../output
+		git submodule sync --recursive ../submodule >../../output
 	) &&
 	grep "\\.\\./submodule/sub-submodule" output &&
+	! grep submodule2 output &&
 	test -d "$(
 		cd super-clone/submodule &&
 		git config remote.origin.url
-- 
2.7.2.368.g934fe14
Previous: Stefan BellerNext: Duy Nguyen
Message 3 of 4 in “recursive submodules: paths are hard”
  1. 0/2 recursive submodules: paths are hardStefan Beller, Feb 26, 2016
  2. 1/2 Check recursive submodule update to have correct path from subdirectoryStefan Beller, Feb 26, 2016
  3. 2/2 submodule sync: Test we can pass individual submodulesStefan Beller, Feb 26, 2016
  4. Duy NguyenFeb 27, 2016

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.