1#!/bin/sh23test_description='remote tracking stats'45. ./test-lib.sh67advance () {8echo "$1" >"$1" &&9git add "$1" &&10test_tick &&11git commit -m "$1"12}1314test_expect_success setup '15for i in a b c;16do17advance $i || break18done &&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 f32)33'3435script='s/^..\(b.\)[ 0-9a-f]*\[\([^]]*\)\].*/\1 \2/p'36cat >expect <<\EOF37b1 ahead 1, behind 138b2 ahead 1, behind 139b3 behind 140b4 ahead 241EOF4243test_expect_success 'branch -v' '44(45cd test &&46git branch -v47) |48sed -n -e "$script" >actual &&49test_cmp expect actual50'5152test_expect_success 'checkout' '53(54cd test && git checkout b155) >actual &&56grep -e "have 1 and 1 different" actual57'5859test_expect_success 'status' '60(61cd test &&62git checkout b1 >/dev/null &&63# reports nothing to commit64test_must_fail git status65) >actual &&66grep -e "have 1 and 1 different" actual67'686970test_done