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 62 63
|
#!/usr/bin/env bash
set -e
source test/setup
use Test::More
git clone "$UPSTREAM/init" "$OWNER/init" &>/dev/null
gitrepo=$OWNER/init/doc/.gitrepo
# Test that the initial repo look ok:
{
test-exists \
"$OWNER/init/.git/" \
"$OWNER/init/ReadMe" \
"$OWNER/init/doc/" \
"$OWNER/init/doc/init.swim" \
"!$gitrepo"
}
output=$(
cd "$OWNER/init"
git subrepo init doc
)
is "$output" "Subrepo created from 'doc' (with no remote)." \
'Command output is correct'
{
test-exists \
"$gitrepo"
}
# Test init/doc/.gitrepo file contents:
{
test-gitrepo-comment-block
test-gitrepo-field "remote" "none"
test-gitrepo-field "branch" "master"
test-gitrepo-field "commit" ""
test-gitrepo-field "parent" ""
test-gitrepo-field "method" "merge"
test-gitrepo-field "cmdver" "$(git subrepo --version)"
}
rm -fr "$OWNER/init"
git clone "$UPSTREAM/init" "$OWNER/init" &>/dev/null
(
cd "$OWNER/init"
git subrepo init doc -r git@github.com:user/repo -b foo -M rebase
) >/dev/null
test-gitrepo-field "remote" "git@github.com:user/repo"
test-gitrepo-field "branch" "foo"
test-gitrepo-field "commit" ""
test-gitrepo-field "parent" ""
test-gitrepo-field "method" "rebase"
test-gitrepo-field "cmdver" "$(git subrepo --version)"
done_testing
teardown
|