git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v8 9/9] blame: add a test to cover blame_coalesce()

From
BRBarret Rhoden <brho@google.com>
Date
Jun 10, 2019, 15:30 UTC
Message-ID
<20190610153014.42055-10-brho@google.com>
In-Reply-To
<20190610153014.42055-1-brho@google.com>
Signed-off-by: Barret Rhoden <brho@google.com>
---
 t/t8003-blame-corner-cases.sh | 36 +++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh
index c92a47b6d5b1..1c5fb1d1f8c9 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
-- 
2.22.0.rc2.383.gf4fbbf30c2-goog
Previous: Barret Rhoden
Message 14 of 14 in “blame: add the ability to ignore commits”
  1. 0/9 blame: add the ability to ignore commitsBarret Rhoden, Jun 10, 2019
  2. 1/9 fsck: rename and touch up init_skiplist()Barret Rhoden, Jun 10, 2019
  3. 2/9 Move oidset_parse_file() to oidset.cBarret Rhoden, Jun 10, 2019
  4. 3/9 blame: use a helper function in blame_chunk()Barret Rhoden, Jun 10, 2019
  5. 4/9 blame: add the ability to ignore commits and their changesBarret Rhoden, Jun 10, 2019
  6. 5/9 blame: add config options for the output of ignored or unblamable linesBarret Rhoden, Jun 10, 2019
  7. 6/9 blame: optionally track line fingerprints during fill_blame_origin()Barret Rhoden, Jun 10, 2019
  8. 7/9 blame: add a fingerprint heuristic to match ignored linesBarret Rhoden, Jun 10, 2019
  9. SZEDER GáborJun 13, 2019
  10. Junio C HamanoJun 13, 2019
  11. t8014: avoid git command in upstream pipemichael@platin.gs, Jun 16, 2019
  12. Barret RhodenJun 17, 2019
  13. 8/9 blame: use the fingerprint heuristic to match ignored linesBarret Rhoden, Jun 10, 2019
  14. 9/9 blame: add a test to cover blame_coalesce()Barret Rhoden, Jun 10, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.