aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarret Rhoden <brho@google.com>2019-06-20 12:38:20 -0400
committerJunio C Hamano <gitster@pobox.com>2019-06-20 13:38:09 -0700
commitf0cbe742f4b5d7f38941197f4a450e48908f13bc (patch)
tree5adca63663ac411819e242e6423571cb0ed36d71
parentblame: use the fingerprint heuristic to match ignored lines (diff)
downloadgit-f0cbe742f4b5d7f38941197f4a450e48908f13bc.tar.gz
git-f0cbe742f4b5d7f38941197f4a450e48908f13bc.zip
blame: add a test to cover blame_coalesce()
Signed-off-by: Barret Rhoden <brho@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t8003-blame-corner-cases.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh
index c92a47b6d5..1c5fb1d1f8 100755
--- a/t/t8003-blame-corner-cases.sh
+++ b/t/t8003-blame-corner-cases.sh
@@ -275,4 +275,40 @@ test_expect_success 'blame file with CRLF core.autocrlf=true' '
grep "A U Thor" actual
'
+# Tests the splitting and merging of blame entries in blame_coalesce().
+# The output of blame is the same, regardless of whether blame_coalesce() runs
+# or not, so we'd likely only notice a problem if blame crashes or assigned
+# blame to the "splitting" commit ('SPLIT' below).
+test_expect_success 'blame coalesce' '
+ cat >giraffe <<-\EOF &&
+ ABC
+ DEF
+ EOF
+ git add giraffe &&
+ git commit -m "original file" &&
+ oid=$(git rev-parse HEAD) &&
+
+ cat >giraffe <<-\EOF &&
+ ABC
+ SPLIT
+ DEF
+ EOF
+ git add giraffe &&
+ git commit -m "interior SPLIT line" &&
+
+ cat >giraffe <<-\EOF &&
+ ABC
+ DEF
+ EOF
+ git add giraffe &&
+ git commit -m "same contents as original" &&
+
+ cat >expect <<-EOF &&
+ $oid 1) ABC
+ $oid 2) DEF
+ EOF
+ git -c core.abbrev=40 blame -s giraffe >actual &&
+ test_cmp expect actual
+'
+
test_done