From: Sean Barag <sean@xxxxxxxxx> 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. Signed-off-by: Sean Barag <sean@xxxxxxxxx> --- t/t5606-clone-options.sh | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/t/t5606-clone-options.sh b/t/t5606-clone-options.sh index e69427f881..d20a78f84b 100755 --- a/t/t5606-clone-options.sh +++ b/t/t5606-clone-options.sh @@ -19,6 +19,50 @@ test_expect_success 'clone -o' ' ' +test_expect_success 'disallows --bare with --origin' ' + + test_expect_code 128 git clone -o foo --bare parent clone-bare-o 2>err && + test_debug "cat err" && + test_i18ngrep "\-\-bare and --origin foo options are incompatible" err + +' + +test_expect_success 'disallows --bare with --separate-git-dir' ' + + test_expect_code 128 git clone --bare --separate-git-dir dot-git-destiation parent clone-bare-sgd 2>err && + test_debug "cat err" && + test_i18ngrep "\-\-bare and --separate-git-dir are incompatible" err + +' + +test_expect_success 'uses "origin" for default remote name' ' + + git clone parent clone-default-origin && + (cd clone-default-origin && git 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 && + (cd clone-template-config && test "$(git 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 && + (cd clone-template-inline-config && test "$(git config --local foo.bar)" = "inline") + +' + test_expect_success 'redirected clone does not show progress' ' git clone "file://$(pwd)/parent" clone-redirected >out 2>err && -- gitgitgadget