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

[PATCH 1/2] push: --dry-run updates submodules when --recurse-submodules=on-demand

From
BWBrandon Williams <bmwill@google.com>
Date
Nov 15, 2016, 01:18 UTC
Message-ID
<1479172735-698-2-git-send-email-bmwill@google.com>
In-Reply-To
<1479172735-698-1-git-send-email-bmwill@google.com>

This patch adds a test to illustrate how push run with --dry-run doesn't actually perform a dry-run when push is configured to push submodules on-demand. Instead all submodules which need to be pushed are actually pushed to their remotes while any updates for the superproject are performed as a dry-run. This is a bug and not the intended behaviour of a dry-run.

Signed-off-by: Brandon Williams <bmwill@google.com>
---
 t/t5531-deep-submodule-push.sh | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh
index 198ce84..e6ccc30 100755
--- a/t/t5531-deep-submodule-push.sh
+++ b/t/t5531-deep-submodule-push.sh
@@ -427,7 +427,31 @@ test_expect_success 'push unpushable submodule recursively fails' '
 		cd submodule.git &&
 		git rev-parse master >../actual
 	) &&
-	test_cmp expected actual
+	test_cmp expected actual &&
+	git -C work reset --hard master^
+'
+
+test_expect_failure 'push --dry-run does not recursively update submodules' '
+	(
+		cd work &&
+		(
+			cd gar/bage &&
+			git checkout master &&
+			git rev-parse master >../../../expected_submodule &&
+			> junk9 &&
+			git add junk9 &&
+			git commit -m "Ninth junk"
+		) &&
+		git checkout master &&
+		git rev-parse master >../expected_pub
+		git add gar/bage &&
+		git commit -m "Ninth commit for gar/bage" &&
+		git push --dry-run --recurse-submodules=on-demand ../pub.git master
+	) &&
+	git -C submodule.git rev-parse master >actual_submodule &&
+	git -C pub.git rev-parse master >actual_pub &&
+	test_cmp expected_pub actual_pub &&
+	test_cmp expected_submodule actual_submodule
 '
 
 test_done
-- 
2.8.0.rc3.226.g39d4020
Previous: Brandon WilliamsNext: Johannes Sixt
Message 2 of 16 in “bug fix with push --dry-run and submodules”
  1. 0/2 bug fix with push --dry-run and submodulesBrandon Williams, Nov 15, 2016
  2. 1/2 push: --dry-run updates submodules when --recurse-submodules=on-demandBrandon Williams, Nov 15, 2016
  3. Johannes SixtNov 15, 2016
  4. Brandon WilliamsNov 15, 2016
  5. Johannes SixtNov 15, 2016
  6. 2/2 push: fix --dry-run to not push submodulesBrandon Williams, Nov 15, 2016
  7. 0/2 bug fix with push --dry-run and submodulesBrandon Williams, Nov 17, 2016
  8. 1/2 push: --dry-run updates submodules when --recurse-submodules=on-demandBrandon Williams, Nov 17, 2016
  9. 2/2 push: fix --dry-run to not push submodulesBrandon Williams, Nov 17, 2016
  10. Stefan BellerNov 17, 2016
  11. Brandon WilliamsNov 17, 2016
  12. Junio C HamanoNov 22, 2016
  13. Brandon WilliamsNov 22, 2016
  14. Junio C HamanoNov 23, 2016
  15. Stefan BellerNov 17, 2016
  16. Brandon WilliamsNov 17, 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.