t1301-shared-repo: fix forced modes test
[git/mingw/4msysgit.git] / t / t6040-tracking-info.sh
blobba9060190d31f0b57a461c114e1c856523845f78
1 #!/bin/sh
3 test_description='remote tracking stats'
5 . ./test-lib.sh
7 advance () {
8 echo "$1" >"$1" &&
9 git add "$1" &&
10 test_tick &&
11 git commit -m "$1"
14 test_expect_success setup '
15 for i in a b c;
17 advance $i || break
18 done &&
19 git clone . test &&
21 cd test &&
22 git checkout -b b1 origin &&
23 git reset --hard HEAD^ &&
24 advance d &&
25 git checkout -b b2 origin &&
26 git reset --hard b1 &&
27 git checkout -b b3 origin &&
28 git reset --hard HEAD^ &&
29 git checkout -b b4 origin &&
30 advance e &&
31 advance f
35 script='s/^..\(b.\)[ 0-9a-f]*\[\([^]]*\)\].*/\1 \2/p'
36 cat >expect <<\EOF
37 b1 ahead 1, behind 1
38 b2 ahead 1, behind 1
39 b3 behind 1
40 b4 ahead 2
41 EOF
43 test_expect_success 'branch -v' '
45 cd test &&
46 git branch -v
47 ) |
48 sed -n -e "$script" >actual &&
49 test_cmp expect actual
52 test_expect_success 'checkout' '
54 cd test && git checkout b1
55 ) >actual &&
56 grep "have 1 and 1 different" actual
59 test_expect_success 'status' '
61 cd test &&
62 git checkout b1 >/dev/null &&
63 # reports nothing to commit
64 test_must_fail git status
65 ) >actual &&
66 grep "have 1 and 1 different" actual
70 test_done