Skip to content

Instantly share code, notes, and snippets.

@jvshahid
Created May 27, 2017 13:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jvshahid/b778702cc3d825c6887d2707e866a9c8 to your computer and use it in GitHub Desktop.
Save jvshahid/b778702cc3d825c6887d2707e866a9c8 to your computer and use it in GitHub Desktop.
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