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
|
#!/usr/bin/env bash
source test/setup
use Test::More
clone-foo-and-bar
subrepo-clone-bar-into-foo
(
cd "$OWNER/bar"
git checkout -b branch1
git push --set-upstream origin branch1
) &> /dev/null || die
# Test subrepo file content:
# shellcheck disable=2034
gitrepo=$OWNER/foo/bar/.gitrepo
{
foo_pull_commit=$(cd "$OWNER/foo" || exit; git rev-parse HEAD^)
bar_head_commit=$(cd "$OWNER/bar" || exit; git rev-parse HEAD)
test-gitrepo-comment-block
test-gitrepo-field remote "$UPSTREAM/bar"
test-gitrepo-field branch master
test-gitrepo-field commit "$bar_head_commit"
test-gitrepo-field parent "$foo_pull_commit"
test-gitrepo-field cmdver "$(git subrepo --version)"
}
(
cd "$OWNER/foo"
git subrepo pull bar -b branch1 -u
) &> /dev/null || die
{
foo_pull_commit=$(cd "$OWNER/foo" || exit; git rev-parse HEAD^)
bar_head_commit=$(cd "$OWNER/bar" || exit; git rev-parse HEAD)
test-gitrepo-comment-block
test-gitrepo-field remote "$UPSTREAM/bar"
test-gitrepo-field branch branch1
test-gitrepo-field commit "$bar_head_commit"
test-gitrepo-field parent "$foo_pull_commit"
test-gitrepo-field cmdver "$(git subrepo --version)"
}
{
is "$(
cd "$OWNER/foo" || exit
git subrepo pull bar
)" \
"Subrepo 'bar' is up to date." \
'subrepo detects that we dont need to pull'
}
done_testing
teardown
|