summaryrefslogtreecommitdiff
path: root/t/t3200-branch.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-03-14 22:23:20 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-14 22:23:20 (GMT)
commit073778017158ecf3153b050776029907bc75826f (patch)
tree0723a4eea498071a8d79dcbfe949b59bae3caf9d /t/t3200-branch.sh
parentd6857a831ca86c0ab0157722728696537700dad0 (diff)
parentac5bbc02b8c3781d517f1414655270b3fa38b028 (diff)
downloadgit-073778017158ecf3153b050776029907bc75826f.zip
git-073778017158ecf3153b050776029907bc75826f.tar.gz
git-073778017158ecf3153b050776029907bc75826f.tar.bz2
Merge branch 'kn/ref-filter-branch-list'
"git branch --list" takes the "--abbrev" and "--no-abbrev" options to control the output of the object name in its "-v"(erbose) output, but a recent update started ignoring them; this fixes it before the breakage reaches to any released version. * kn/ref-filter-branch-list: branch: honor --abbrev/--no-abbrev in --list mode
Diffstat (limited to 't/t3200-branch.sh')
-rwxr-xr-xt/t3200-branch.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index e36ed3b..9f353c0 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -213,6 +213,31 @@ test_expect_success 'git branch --list -d t should fail' '
test_path_is_missing .git/refs/heads/t
'
+test_expect_success 'git branch --list -v with --abbrev' '
+ test_when_finished "git branch -D t" &&
+ git branch t &&
+ git branch -v --list t >actual.default &&
+ git branch -v --list --abbrev t >actual.abbrev &&
+ test_cmp actual.default actual.abbrev &&
+
+ git branch -v --list --no-abbrev t >actual.noabbrev &&
+ git branch -v --list --abbrev=0 t >actual.0abbrev &&
+ test_cmp actual.noabbrev actual.0abbrev &&
+
+ git branch -v --list --abbrev=36 t >actual.36abbrev &&
+ # how many hexdigits are used?
+ read name objdefault rest <actual.abbrev &&
+ read name obj36 rest <actual.36abbrev &&
+ objfull=$(git rev-parse --verify t) &&
+
+ # are we really getting abbreviations?
+ test "$obj36" != "$objdefault" &&
+ expr "$obj36" : "$objdefault" >/dev/null &&
+ test "$objfull" != "$obj36" &&
+ expr "$objfull" : "$obj36" >/dev/null
+
+'
+
test_expect_success 'git branch --column' '
COLUMNS=81 git branch --column=column >actual &&
cat >expected <<\EOF &&