Merge branch 'ab/remote-write-config-in-camel-case'
[git] / t / t3202-show-branch-octopus.sh
1 #!/bin/sh
2
3 test_description='test show-branch with more than 8 heads'
4
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8 . ./test-lib.sh
9
10 numbers="1 2 3 4 5 6 7 8 9 10"
11
12 test_expect_success 'setup' '
13
14         > file &&
15         git add file &&
16         test_tick &&
17         git commit -m initial &&
18
19         for i in $numbers
20         do
21                 git checkout -b branch$i main &&
22                 > file$i &&
23                 git add file$i &&
24                 test_tick &&
25                 git commit -m branch$i || return 1
26         done
27
28 '
29
30 cat > expect << EOF
31 ! [branch1] branch1
32  ! [branch2] branch2
33   ! [branch3] branch3
34    ! [branch4] branch4
35     ! [branch5] branch5
36      ! [branch6] branch6
37       ! [branch7] branch7
38        ! [branch8] branch8
39         ! [branch9] branch9
40          * [branch10] branch10
41 ----------
42          * [branch10] branch10
43         +  [branch9] branch9
44        +   [branch8] branch8
45       +    [branch7] branch7
46      +     [branch6] branch6
47     +      [branch5] branch5
48    +       [branch4] branch4
49   +        [branch3] branch3
50  +         [branch2] branch2
51 +          [branch1] branch1
52 +++++++++* [branch10^] initial
53 EOF
54
55 test_expect_success 'show-branch with more than 8 branches' '
56
57         git show-branch $(for i in $numbers; do echo branch$i; done) > out &&
58         test_cmp expect out
59
60 '
61
62 test_expect_success 'show-branch with showbranch.default' '
63         for i in $numbers; do
64                 git config --add showbranch.default branch$i
65         done &&
66         git show-branch >out &&
67         test_cmp expect out
68 '
69
70 test_done