Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
test case for push with submodules
#!/bin/sh
test_description='diff-branch-submodule-push'
. ./test-lib.sh
test_expect_success setup '
mkdir pub.git &&
mkdir sub.git &&
GIT_DIR=pub.git git init --bare &&
GIT_DIR=sub.git git init --bare &&
mkdir sub-repo &&
(
cd sub-repo &&
git init &&
>junk &&
git add . &&
git commit -m "Initial junk" &&
git remote add origin ../sub.git &&
git push origin master
) &&
mkdir work &&
(
cd work &&
git init &&
git submodule add ../sub.git sub &&
git add . &&
git commit -m "Initial superproject" &&
git remote add origin ../pub.git &&
git push origin master
)
'
test_expect_success 'push if submodule has is on a different branch' '
(
cd work/sub &&
>junk2 &&
git add junk2 &&
git commit -m "Second junk"
) &&
(
cd work &&
git checkout -b develop &&
git push --set-upstream origin develop
) &&
(
cd work &&
git add sub &&
git commit -m "Second commit for gar/bage" &&
git push --recurse-submodules=on-demand
)
'
test_done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment