diff options
author | Sean Barag <sean@barag.org> | 2020-09-29 03:36:49 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-09-29 12:36:10 -0700 |
commit | 349cff76de7fdb3b44c7018474134566a7a4ee19 (patch) | |
tree | 65d2eccd2b05c07db1794caab78a28e84d174141 /t | |
parent | Fourteenth batch (diff) | |
download | tgif-349cff76de7fdb3b44c7018474134566a7a4ee19.tar.xz |
clone: add tests for --template and some disallowed option pairs
Some combinations of command-line options to `git clone` are invalid,
but there were previously no tests ensuring those combinations reported
errors. Similarly, `git clone --template` didn't appear to have any
tests.
Helped-by: Jeff King <peff@peff.net>
Helped-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Sean Barag <sean@barag.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t5606-clone-options.sh | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/t/t5606-clone-options.sh b/t/t5606-clone-options.sh index e69427f881..0422b24258 100755 --- a/t/t5606-clone-options.sh +++ b/t/t5606-clone-options.sh @@ -15,7 +15,51 @@ test_expect_success 'setup' ' test_expect_success 'clone -o' ' git clone -o foo parent clone-o && - (cd clone-o && git rev-parse --verify refs/remotes/foo/master) + git -C clone-o rev-parse --verify refs/remotes/foo/master + +' + +test_expect_success 'disallows --bare with --origin' ' + + test_must_fail git clone -o foo --bare parent clone-bare-o 2>err && + test_debug "cat err" && + test_i18ngrep -e "--bare and --origin foo options are incompatible" err + +' + +test_expect_success 'disallows --bare with --separate-git-dir' ' + + test_must_fail git clone --bare --separate-git-dir dot-git-destiation parent clone-bare-sgd 2>err && + test_debug "cat err" && + test_i18ngrep -e "--bare and --separate-git-dir are incompatible" err + +' + +test_expect_success 'uses "origin" for default remote name' ' + + git clone parent clone-default-origin && + git -C clone-default-origin rev-parse --verify refs/remotes/origin/master + +' + +test_expect_success 'prefers --template config over normal config' ' + + template="$TRASH_DIRECTORY/template-with-config" && + mkdir "$template" && + git config --file "$template/config" foo.bar from_template && + test_config_global foo.bar from_global && + git clone "--template=$template" parent clone-template-config && + test "$(git -C clone-template-config config --local foo.bar)" = "from_template" + +' + +test_expect_success 'prefers -c config over --template config' ' + + template="$TRASH_DIRECTORY/template-with-ignored-config" && + mkdir "$template" && + git config --file "$template/config" foo.bar from_template && + git clone "--template=$template" -c foo.bar=inline parent clone-template-inline-config && + test "$(git -C clone-template-inline-config config --local foo.bar)" = "inline" ' |