summaryrefslogtreecommitdiff
path: root/t/t5531-deep-submodule-push.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t5531-deep-submodule-push.sh')
-rwxr-xr-xt/t5531-deep-submodule-push.sh152
1 files changed, 151 insertions, 1 deletions
diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh
index 6507487c1a..9fda7b0c19 100755
--- a/t/t5531-deep-submodule-push.sh
+++ b/t/t5531-deep-submodule-push.sh
@@ -64,7 +64,12 @@ test_expect_success 'push fails if submodule commit not on remote' '
cd work &&
git add gar/bage &&
git commit -m "Third commit for gar/bage" &&
- test_must_fail git push --recurse-submodules=check ../pub.git master
+ # the push should fail with --recurse-submodules=check
+ # on the command line...
+ test_must_fail git push --recurse-submodules=check ../pub.git master &&
+
+ # ...or if specified in the configuration..
+ test_must_fail git -c push.recurseSubmodules=check push ../pub.git master
)
'
@@ -79,6 +84,151 @@ test_expect_success 'push succeeds after commit was pushed to remote' '
)
'
+test_expect_success 'push succeeds if submodule commit not on remote but using on-demand on command line' '
+ (
+ cd work/gar/bage &&
+ >recurse-on-demand-on-command-line &&
+ git add recurse-on-demand-on-command-line &&
+ git commit -m "Recurse on-demand on command line junk"
+ ) &&
+ (
+ cd work &&
+ git add gar/bage &&
+ git commit -m "Recurse on-demand on command line for gar/bage" &&
+ git push --recurse-submodules=on-demand ../pub.git master &&
+ # Check that the supermodule commit got there
+ git fetch ../pub.git &&
+ git diff --quiet FETCH_HEAD master &&
+ # Check that the submodule commit got there too
+ cd gar/bage &&
+ git diff --quiet origin/master master
+ )
+'
+
+test_expect_success 'push succeeds if submodule commit not on remote but using on-demand from config' '
+ (
+ cd work/gar/bage &&
+ >recurse-on-demand-from-config &&
+ git add recurse-on-demand-from-config &&
+ git commit -m "Recurse on-demand from config junk"
+ ) &&
+ (
+ cd work &&
+ git add gar/bage &&
+ git commit -m "Recurse on-demand from config for gar/bage" &&
+ git -c push.recurseSubmodules=on-demand push ../pub.git master &&
+ # Check that the supermodule commit got there
+ git fetch ../pub.git &&
+ git diff --quiet FETCH_HEAD master &&
+ # Check that the submodule commit got there too
+ cd gar/bage &&
+ git diff --quiet origin/master master
+ )
+'
+
+test_expect_success 'push fails if submodule commit not on remote using check from cmdline overriding config' '
+ (
+ cd work/gar/bage &&
+ >recurse-check-on-command-line-overriding-config &&
+ git add recurse-check-on-command-line-overriding-config &&
+ git commit -m "Recurse on command-line overridiing config junk"
+ ) &&
+ (
+ cd work &&
+ git add gar/bage &&
+ git commit -m "Recurse on command-line overriding config for gar/bage" &&
+ test_must_fail git -c push.recurseSubmodules=on-demand push --recurse-submodules=check ../pub.git master &&
+ # Check that the supermodule commit did not get there
+ git fetch ../pub.git &&
+ git diff --quiet FETCH_HEAD master^ &&
+ # Check that the submodule commit did not get there
+ cd gar/bage &&
+ git diff --quiet origin/master master^
+ )
+'
+
+test_expect_success 'push succeeds if submodule commit not on remote using on-demand from cmdline overriding config' '
+ (
+ cd work/gar/bage &&
+ >recurse-on-demand-on-command-line-overriding-config &&
+ git add recurse-on-demand-on-command-line-overriding-config &&
+ git commit -m "Recurse on-demand on command-line overriding config junk"
+ ) &&
+ (
+ cd work &&
+ git add gar/bage &&
+ git commit -m "Recurse on-demand on command-line overriding config for gar/bage" &&
+ git -c push.recurseSubmodules=check push --recurse-submodules=on-demand ../pub.git master &&
+ # Check that the supermodule commit got there
+ git fetch ../pub.git &&
+ git diff --quiet FETCH_HEAD master &&
+ # Check that the submodule commit got there
+ cd gar/bage &&
+ git diff --quiet origin/master master
+ )
+'
+
+test_expect_success 'push succeeds if submodule commit disabling recursion from cmdline overriding config' '
+ (
+ cd work/gar/bage &&
+ >recurse-disable-on-command-line-overriding-config &&
+ git add recurse-disable-on-command-line-overriding-config &&
+ git commit -m "Recurse disable on command-line overriding config junk"
+ ) &&
+ (
+ cd work &&
+ git add gar/bage &&
+ git commit -m "Recurse disable on command-line overriding config for gar/bage" &&
+ git -c push.recurseSubmodules=check push --recurse-submodules=no ../pub.git master &&
+ # Check that the supermodule commit got there
+ git fetch ../pub.git &&
+ git diff --quiet FETCH_HEAD master &&
+ # But that the submodule commit did not
+ ( cd gar/bage && git diff --quiet origin/master master^ ) &&
+ # Now push it to avoid confusing future tests
+ git push --recurse-submodules=on-demand ../pub.git master
+ )
+'
+
+test_expect_success 'push succeeds if submodule commit disabling recursion from cmdline (alternative form) overriding config' '
+ (
+ cd work/gar/bage &&
+ >recurse-disable-on-command-line-alt-overriding-config &&
+ git add recurse-disable-on-command-line-alt-overriding-config &&
+ git commit -m "Recurse disable on command-line alternative overriding config junk"
+ ) &&
+ (
+ cd work &&
+ git add gar/bage &&
+ git commit -m "Recurse disable on command-line alternative overriding config for gar/bage" &&
+ git -c push.recurseSubmodules=check push --no-recurse-submodules ../pub.git master &&
+ # Check that the supermodule commit got there
+ git fetch ../pub.git &&
+ git diff --quiet FETCH_HEAD master &&
+ # But that the submodule commit did not
+ ( cd gar/bage && git diff --quiet origin/master master^ ) &&
+ # Now push it to avoid confusing future tests
+ git push --recurse-submodules=on-demand ../pub.git master
+ )
+'
+
+test_expect_success 'push fails if recurse submodules option passed as yes' '
+ (
+ cd work/gar/bage &&
+ >recurse-push-fails-if-recurse-submodules-passed-as-yes &&
+ git add recurse-push-fails-if-recurse-submodules-passed-as-yes &&
+ git commit -m "Recurse push fails if recurse submodules option passed as yes"
+ ) &&
+ (
+ cd work &&
+ git add gar/bage &&
+ git commit -m "Recurse push fails if recurse submodules option passed as yes for gar/bage" &&
+ test_must_fail git push --recurse-submodules=yes ../pub.git master &&
+ test_must_fail git -c push.recurseSubmodules=yes push ../pub.git master &&
+ git push --recurse-submodules=on-demand ../pub.git master
+ )
+'
+
test_expect_success 'push fails when commit on multiple branches if one branch has no remote' '
(
cd work/gar/bage &&