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 57 58 59 60 61
|
#!/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 commit:
add-new-files bar/FooBar
) &> /dev/null || die
# Do the subrepo push to another branch:
{
message=$(
cd "$OWNER/foo"
git subrepo push bar --branch newbar
)
# Test the output:
is "$message" \
"Subrepo 'bar' pushed to '$UPSTREAM/bar' (newbar)." \
'First push message is correct '
}
# Do the subrepo push to another branch again:
{
message=$(
cd "$OWNER/foo"
git subrepo push bar --branch newbar
)
# Test the output:
is "$message" \
"Subrepo 'bar' has no new commits to push." \
'Second push message is correct'
}
# Pull the changes from UPSTREAM/bar in OWNER/bar
(
cd "$OWNER/bar"
git fetch
git checkout newbar
) &> /dev/null || die
test-exists \
"$OWNER/bar/FooBar" \
done_testing
teardown
|