diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-03-14 15:23:20 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-14 15:23:20 -0700 |
commit | 073778017158ecf3153b050776029907bc75826f (patch) | |
tree | 0723a4eea498071a8d79dcbfe949b59bae3caf9d /t | |
parent | d6857a831ca86c0ab0157722728696537700dad0 (diff) | |
parent | ac5bbc02b8c3781d517f1414655270b3fa38b028 (diff) | |
download | git-073778017158ecf3153b050776029907bc75826f.tar.gz |
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')
-rwxr-xr-x | t/t3200-branch.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index e36ed3b4e1..9f353c0efc 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 && |