]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t8003: factor setup out of coalesce test
authorJeff King <peff@peff.net>
Thu, 13 Aug 2020 05:23:41 +0000 (01:23 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 13 Aug 2020 17:08:24 +0000 (10:08 -0700)
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>
t/t8003-blame-corner-cases.sh

index 7f0d4f7a9678d186bc4a39ab39b2d6272f81d3c9..383ba2bbd64b7bf82d54e9db6d707e4e01430147 100755 (executable)
@@ -274,14 +274,14 @@ test_expect_success 'blame file with CRLF core.autocrlf=true' '
        grep "A U Thor" actual
 '
 
-test_expect_success 'blame coalesce' '
+test_expect_success 'setup coalesce tests' '
        cat >giraffe <<-\EOF &&
        ABC
        DEF
        EOF
        git add giraffe &&
        git commit -m "original file" &&
-       oid=$(git rev-parse HEAD) &&
+       orig=$(git rev-parse HEAD) &&
 
        cat >giraffe <<-\EOF &&
        ABC
@@ -290,6 +290,7 @@ test_expect_success 'blame coalesce' '
        EOF
        git add giraffe &&
        git commit -m "interior SPLIT line" &&
+       split=$(git rev-parse HEAD) &&
 
        cat >giraffe <<-\EOF &&
        ABC
@@ -297,13 +298,16 @@ test_expect_success 'blame coalesce' '
        EOF
        git add giraffe &&
        git commit -m "same contents as original" &&
+       final=$(git rev-parse HEAD)
+'
 
+test_expect_success 'blame coalesce' '
        cat >expect <<-EOF &&
-       $oid 1 1 2
-       $oid 2 2
+       $orig 1 1 2
+       $orig 2 2
        EOF
-       git blame --porcelain giraffe >actual.raw &&
-       grep "^$oid" actual.raw >actual &&
+       git blame --porcelain $final giraffe >actual.raw &&
+       grep "^$orig" actual.raw >actual &&
        test_cmp expect actual
 '