1#!/bin/sh
23
test_description='remote tracking stats'
45
. ./test-lib.sh
67
advance () {
8echo "$1" >"$1" &&
9git add "$1" &&
10test_tick &&
11git commit -m "$1"
12}
1314
test_expect_success setup '
15for i in a b c;
16do
17advance $i || break
18done &&
19git clone . test &&
20(
21cd test &&
22git checkout -b b1 origin &&
23git reset --hard HEAD^ &&
24advance d &&
25git checkout -b b2 origin &&
26git reset --hard b1 &&
27git checkout -b b3 origin &&
28git reset --hard HEAD^ &&
29git checkout -b b4 origin &&
30advance e &&
31advance f
32)
33'
3435
script='s/^..\(b.\)[ 0-9a-f]*\[\([^]]*\)\].*/\1 \2/p'
36cat >expect <<\EOF
37b1 ahead 1, behind 1
38b2 ahead 1, behind 1
39b3 behind 1
40b4 ahead 2
41EOF
4243
test_expect_success 'branch -v' '
44(
45cd test &&
46git branch -v
47) |
48sed -n -e "$script" >actual &&
49test_cmp expect actual
50'
5152
test_expect_success 'checkout' '
53(
54cd test && git checkout b1
55) >actual &&
56grep -e "have 1 and 1 different" actual
57'
5859
test_expect_success 'status' '
60(
61cd test &&
62git checkout b1 >/dev/null &&
63# reports nothing to commit
64test_must_fail git status
65) >actual &&
66grep -e "have 1 and 1 different" actual
67'
6869
70
test_done