Skip to content

Commit 6dbf0c7

Browse files
peffgitster
authored andcommitted
t8003: check output of coalesced blame
Commit f0cbe74 (blame: add a test to cover blame_coalesce(), 2019-06-20) added a test case where blame can usefully coalesce two groups of lines. But since it relies on the normal blame output, it only exercises the code and can't tell whether the lines were actually joined into a single group. However, by using --porcelain output, we can see how git-blame considers the groupings (and likewise how the coalescing might have a real user-visible impact for a tool that uses the porcelain-output groupings). This lets us confirm that we are indeed coalescing correctly (and the fact that this test case requires coalescing can be verified by dropping the call to blame_coalesce(), causing the test to fail). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 47ae905 commit 6dbf0c7

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

t/t8003-blame-corner-cases.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,6 @@ test_expect_success 'blame file with CRLF core.autocrlf=true' '
274274
grep "A U Thor" actual
275275
'
276276

277-
# Tests the splitting and merging of blame entries in blame_coalesce().
278-
# The output of blame is the same, regardless of whether blame_coalesce() runs
279-
# or not, so we'd likely only notice a problem if blame crashes or assigned
280-
# blame to the "splitting" commit ('SPLIT' below).
281277
test_expect_success 'blame coalesce' '
282278
cat >giraffe <<-\EOF &&
283279
ABC
@@ -303,10 +299,11 @@ test_expect_success 'blame coalesce' '
303299
git commit -m "same contents as original" &&
304300
305301
cat >expect <<-EOF &&
306-
$oid 1) ABC
307-
$oid 2) DEF
302+
$oid 1 1 2
303+
$oid 2 2
308304
EOF
309-
git -c core.abbrev=40 blame -s giraffe >actual &&
305+
git blame --porcelain giraffe >actual.raw &&
306+
grep "^$oid" actual.raw >actual &&
310307
test_cmp expect actual
311308
'
312309

0 commit comments

Comments
 (0)