Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarret Rhoden <brho@google.com>2019-06-20 19:38:20 +0300
committerJunio C Hamano <gitster@pobox.com>2019-06-20 23:38:09 +0300
commitf0cbe742f4b5d7f38941197f4a450e48908f13bc (patch)
tree5adca63663ac411819e242e6423571cb0ed36d71 /t/t8003-blame-corner-cases.sh
parenta07a97760cbf2e794600157a5a9f61a888a17941 (diff)
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>
Diffstat (limited to 't/t8003-blame-corner-cases.sh')
-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