revision: avoid out-of-bounds read/write on empty pathspec
[git.git] / t / t5606-clone-options.sh
blobe69427f8817a6e2170ce1175991e8badb0e78ecb
1 #!/bin/sh
3 test_description='basic clone options'
4 . ./test-lib.sh
6 test_expect_success 'setup' '
8 mkdir parent &&
9 (cd parent && git init &&
10 echo one >file && git add file &&
11 git commit -m one)
15 test_expect_success 'clone -o' '
17 git clone -o foo parent clone-o &&
18 (cd clone-o && git rev-parse --verify refs/remotes/foo/master)
22 test_expect_success 'redirected clone does not show progress' '
24 git clone "file://$(pwd)/parent" clone-redirected >out 2>err &&
25 ! grep % err &&
26 test_i18ngrep ! "Checking connectivity" err
30 test_expect_success 'redirected clone -v does show progress' '
32 git clone --progress "file://$(pwd)/parent" clone-redirected-progress \
33 >out 2>err &&
34 grep % err
38 test_expect_success 'chooses correct default initial branch name' '
39 git init --bare empty &&
40 git -c init.defaultBranch=up clone empty whats-up &&
41 test refs/heads/up = $(git -C whats-up symbolic-ref HEAD) &&
42 test refs/heads/up = $(git -C whats-up config branch.up.merge)
45 test_expect_success 'guesses initial branch name correctly' '
46 git init --initial-branch=guess initial-branch &&
47 test_commit -C initial-branch no-spoilers &&
48 git -C initial-branch branch abc guess &&
49 git clone initial-branch is-it &&
50 test refs/heads/guess = $(git -C is-it symbolic-ref HEAD) &&
52 git -c init.defaultBranch=none init --bare no-head &&
53 git -C initial-branch push ../no-head guess abc &&
54 git clone no-head is-it2 &&
55 test_must_fail git -C is-it2 symbolic-ref refs/remotes/origin/HEAD &&
56 git -C no-head update-ref --no-deref HEAD refs/heads/guess &&
57 git -c init.defaultBranch=guess clone no-head is-it3 &&
58 test refs/remotes/origin/guess = \
59 $(git -C is-it3 symbolic-ref refs/remotes/origin/HEAD)
62 test_done