diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-07-13 15:15:23 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-07-13 15:15:23 -0700 |
commit | e636799b4d6a6a8abad151697eae27044bb8e95b (patch) | |
tree | e62e59e67ec4033dc9ae2504e92ca1e7a69959bf /t | |
parent | fc062aa2e121d7976a741e7b8b5ba98f2e26056d (diff) | |
parent | 926ab840cdc867b54fa93b8e1ece2790315c2456 (diff) | |
download | git-e636799b4d6a6a8abad151697eae27044bb8e95b.tar.gz |
Merge branch 'jc/report-tracking'
* jc/report-tracking:
branch -r -v: do not spit out garbage
stat_tracking_info(): clear object flags used during counting
git-branch -v: show the remote tracking statistics
git-status: show the remote tracking statistics
Refactor "tracking statistics" code used by "git checkout"
Diffstat (limited to 't')
-rwxr-xr-x | t/t6040-tracking-info.sh | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh new file mode 100755 index 0000000000..aac212e936 --- /dev/null +++ b/t/t6040-tracking-info.sh @@ -0,0 +1,70 @@ +#!/bin/sh + +test_description='remote tracking stats' + +. ./test-lib.sh + +advance () { + echo "$1" >"$1" && + git add "$1" && + test_tick && + git commit -m "$1" +} + +test_expect_success setup ' + for i in a b c; + do + advance $i || break + done && + git clone . test && + ( + cd test && + git checkout -b b1 origin && + git reset --hard HEAD^ && + advance d && + git checkout -b b2 origin && + git reset --hard b1 && + git checkout -b b3 origin && + git reset --hard HEAD^ && + git checkout -b b4 origin && + advance e && + advance f + ) +' + +script='s/^..\(b.\)[ 0-9a-f]*\[\([^]]*\)\].*/\1 \2/p' +cat >expect <<\EOF +b1 ahead 1, behind 1 +b2 ahead 1, behind 1 +b3 behind 1 +b4 ahead 2 +EOF + +test_expect_success 'branch -v' ' + ( + cd test && + git branch -v + ) | + sed -n -e "$script" >actual && + test_cmp expect actual +' + +test_expect_success 'checkout' ' + ( + cd test && git checkout b1 + ) >actual && + grep -e "have 1 and 1 different" actual +' + +test_expect_success 'status' ' + ( + cd test && + git checkout b1 >/dev/null && + # reports nothing to commit + test_must_fail git status + ) >actual && + grep -e "have 1 and 1 different" actual +' + + +test_done |