t8003: factor setup out of coalesce test
In preparation for adding more tests of blame's coalesce code, let's split the setup out from the first test, and give each of the commits a more meaningful name: - $orig for the original source that added the lines - $split for the version where they are split apart - $final for the final version that re-joins them That's not strictly necessary, but makes the follow-on tests less brittle than relying on HEAD^, etc, to name the commits. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Aug 13, 2020 at 01:23 UTC
dd7c6111647ecae2315b4f0ca039b92d32e0cadc
1 file changed
+10
-6
t/t8003-blame-corner-cases.sh
+10
-6
@@ -274,14 +274,14 @@ test_expect_success 'blame file with CRLF core.autocrlf=true' '
274
grep "A U Thor" actual
275
'
276
277
-test_expect_success 'blame coalesce' '
277
+test_expect_success 'setup coalesce tests' '
278
cat >giraffe <<-\EOF &&
279
ABC
280
DEF
281
EOF
282
git add giraffe &&
283
git commit -m "original file" &&
284
- oid=$(git rev-parse HEAD) &&
284
+ orig=$(git rev-parse HEAD) &&
285
286
cat >giraffe <<-\EOF &&
287
ABC
@@ -290,6 +290,7 @@ test_expect_success 'blame coalesce' '
290
EOF
291
git add giraffe &&
292
git commit -m "interior SPLIT line" &&
293
+ split=$(git rev-parse HEAD) &&
294
295
cat >giraffe <<-\EOF &&
296
ABC
@@ -297,13 +298,16 @@ test_expect_success 'blame coalesce' '
298
EOF
299
git add giraffe &&
300
git commit -m "same contents as original" &&
301
+ final=$(git rev-parse HEAD)
302
+'
303
304
+test_expect_success 'blame coalesce' '
305
cat >expect <<-EOF &&
302
- $oid 1 1 2
303
- $oid 2 2
306
+ $orig 1 1 2
307
+ $orig 2 2
308
EOF
305
- git blame --porcelain giraffe >actual.raw &&
306
- grep "^$oid" actual.raw >actual &&
309
+ git blame --porcelain $final giraffe >actual.raw &&
310
+ grep "^$orig" actual.raw >actual &&
311
test_cmp expect actual
312
'
313