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 <bmw...@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

Reply via email to