aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-03-08 14:13:09 -0800
committerJunio C Hamano <gitster@pobox.com>2017-03-10 11:47:38 -0800
commitac5bbc02b8c3781d517f1414655270b3fa38b028 (patch)
tree0a1ebf08649475f15e15b8c107d0a5daaa2ee321 /t
parent44a6b6ce1777f587c318008fe59b901a296f5326 (diff)
downloadgit-ac5bbc02b8c3781d517f1414655270b3fa38b028.tar.gz
git-ac5bbc02b8c3781d517f1414655270b3fa38b028.tar.xz
branch: honor --abbrev/--no-abbrev in --list mode
When the "branch --list" command was converted to use the --format facility from the ref-filter API, we forgot to honor the --abbrev setting in the default output format and instead used a hardcoded "7". Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-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 8a833f354..39bd5ac8f 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -207,6 +207,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 &&