]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5606-clone-options.sh
clone: use configured default branch name when appropriate
[thirdparty/git.git] / t / t5606-clone-options.sh
CommitLineData
ecaa0cff
JK
1#!/bin/sh
2
3test_description='basic clone options'
4. ./test-lib.sh
5
6test_expect_success 'setup' '
7
8 mkdir parent &&
9 (cd parent && git init &&
10 echo one >file && git add file &&
11 git commit -m one)
12
13'
14
15test_expect_success 'clone -o' '
16
17 git clone -o foo parent clone-o &&
18 (cd clone-o && git rev-parse --verify refs/remotes/foo/master)
19
20'
21
68b939b2 22test_expect_success 'redirected clone does not show progress' '
21188b1e
MV
23
24 git clone "file://$(pwd)/parent" clone-redirected >out 2>err &&
2856cbf0
JK
25 ! grep % err &&
26 test_i18ngrep ! "Checking connectivity" err
21188b1e
MV
27
28'
68b939b2
JK
29
30test_expect_success 'redirected clone -v does show progress' '
21188b1e 31
5a518ad4
TRC
32 git clone --progress "file://$(pwd)/parent" clone-redirected-progress \
33 >out 2>err &&
68b939b2 34 grep % err
21188b1e
MV
35
36'
37
0cc1b475
JS
38test_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)
43'
44
45test_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)
51'
52
ecaa0cff 53test_done