1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#!/usr/bin/env bash
set -e
source test/setup
use Test::More
clone-foo-and-bar
# Make various changes to the repos for testing subrepo push:
(
# In the main repo:
cd "$OWNER/foo"
# Clone the subrepo into a subdir
git subrepo clone "$UPSTREAM/bar"
# Make a series of commits:
add-new-files bar/FooBar1
add-new-files bar/FooBar2
modify-files bar/FooBar1
add-new-files ./FooBar
modify-files ./FooBar bar/FooBar2
) &> /dev/null || die
# Do the subrepo push and test the output:
{
message=$(
cd "$OWNER/foo"
git subrepo push bar --squash
)
# Test the output:
is "$message" \
"Subrepo 'bar' pushed to '$UPSTREAM/bar' (master)." \
'push message is correct'
}
(
cd "$OWNER/bar"
git pull
) &> /dev/null || die
# Check that all commits arrived in subrepo
test-commit-count "$OWNER/bar" HEAD 3
test-exists \
"$OWNER/bar/Bar" \
"$OWNER/bar/FooBar1" \
"$OWNER/bar/FooBar2" \
"!$OWNER/bar/.gitrepo" \
done_testing
teardown
|