diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-01-31 13:32:07 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-01-31 13:32:07 -0800 |
commit | 5fbb42a21ec6169328e081f7b475e4b56152c5b5 (patch) | |
tree | 8a9d0fb8acdd08b1d1a3f6a8b3bf4e8a47c33cea /t/t8002-blame.sh | |
parent | Merge branch 'jk/archive-zip-userdiff-config' into maint (diff) | |
parent | blame: output porcelain "previous" header for each file (diff) | |
download | tgif-5fbb42a21ec6169328e081f7b475e4b56152c5b5.tar.xz |
Merge branch 'jk/blame-fixes' into maint
"git blame --porcelain" misidentified the "previous" <commit, path>
pair (aka "source") when contents came from two or more files.
* jk/blame-fixes:
blame: output porcelain "previous" header for each file
blame: handle --no-abbrev
blame: fix alignment with --abbrev=40
Diffstat (limited to 't/t8002-blame.sh')
-rwxr-xr-x | t/t8002-blame.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/t/t8002-blame.sh b/t/t8002-blame.sh index ab79de9544..380e1c1054 100755 --- a/t/t8002-blame.sh +++ b/t/t8002-blame.sh @@ -86,4 +86,36 @@ test_expect_success 'blame with showEmail config true' ' test_cmp expected_n result ' +test_expect_success 'set up abbrev tests' ' + test_commit abbrev && + sha1=$(git rev-parse --verify HEAD) && + check_abbrev () { + expect=$1; shift + echo $sha1 | cut -c 1-$expect >expect && + git blame "$@" abbrev.t >actual && + perl -lne "/[0-9a-f]+/ and print \$&" <actual >actual.sha && + test_cmp expect actual.sha + } +' + +test_expect_success 'blame --abbrev=<n> works' ' + # non-boundary commits get +1 for alignment + check_abbrev 31 --abbrev=30 HEAD && + check_abbrev 30 --abbrev=30 ^HEAD +' + +test_expect_success 'blame -l aligns regular and boundary commits' ' + check_abbrev 40 -l HEAD && + check_abbrev 39 -l ^HEAD +' + +test_expect_success 'blame --abbrev=40 behaves like -l' ' + check_abbrev 40 --abbrev=40 HEAD && + check_abbrev 39 --abbrev=40 ^HEAD +' + +test_expect_success '--no-abbrev works like --abbrev=40' ' + check_abbrev 40 --no-abbrev +' + test_done |