Merge branch 'ao/send-email-irt'
[git/kirr.git] / t / t3203-branch-output.sh
blob6028748c6cecaedb087c35182de172ca0e93fe08
1 #!/bin/sh
3 test_description='git branch display tests'
4 . ./test-lib.sh
6 test_expect_success 'make commits' '
7 echo content >file &&
8 git add file &&
9 git commit -m one &&
10 echo content >>file &&
11 git commit -a -m two
14 test_expect_success 'make branches' '
15 git branch branch-one &&
16 git branch branch-two HEAD^
19 test_expect_success 'make remote branches' '
20 git update-ref refs/remotes/origin/branch-one branch-one &&
21 git update-ref refs/remotes/origin/branch-two branch-two &&
22 git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/branch-one
25 cat >expect <<'EOF'
26 branch-one
27 branch-two
28 * master
29 EOF
30 test_expect_success 'git branch shows local branches' '
31 git branch >actual &&
32 test_cmp expect actual
35 cat >expect <<'EOF'
36 origin/HEAD -> origin/branch-one
37 origin/branch-one
38 origin/branch-two
39 EOF
40 test_expect_success 'git branch -r shows remote branches' '
41 git branch -r >actual &&
42 test_cmp expect actual
45 cat >expect <<'EOF'
46 branch-one
47 branch-two
48 * master
49 remotes/origin/HEAD -> origin/branch-one
50 remotes/origin/branch-one
51 remotes/origin/branch-two
52 EOF
53 test_expect_success 'git branch -a shows local and remote branches' '
54 git branch -a >actual &&
55 test_cmp expect actual
58 cat >expect <<'EOF'
59 two
60 one
61 two
62 EOF
63 test_expect_success 'git branch -v shows branch summaries' '
64 git branch -v >tmp &&
65 awk "{print \$NF}" <tmp >actual &&
66 test_cmp expect actual
69 cat >expect <<'EOF'
70 * (no branch)
71 branch-one
72 branch-two
73 master
74 EOF
75 test_expect_success 'git branch shows detached HEAD properly' '
76 git checkout HEAD^0 &&
77 git branch >actual &&
78 test_cmp expect actual
81 test_done