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

[PATCH v3 07/10] t3206: range-diff compares logs with commit notes

From
Denton Liu <liu.denton@gmail.com>
Date
Nov 20, 2019, 21:18 UTC
Message-ID
<093d32ac4f198341232a46bf867317b8c3c7d566.1574284470.git.liu.denton@gmail.com>
In-Reply-To
<cover.1574284470.git.liu.denton@gmail.com>

The test suite had a blindspot where it did not check the behavior of range-diff and format-patch when notes were present. Cover this blindspot.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
---
 t/t3206-range-diff.sh | 52 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh
index f654aed54f..19ba644933 100755
--- a/t/t3206-range-diff.sh
+++ b/t/t3206-range-diff.sh
@@ -505,4 +505,56 @@ test_expect_success 'range-diff overrides diff.noprefix internally' '
 	git -c diff.noprefix=true range-diff HEAD^...
 '
 
+test_expect_success 'range-diff compares notes by default' '
+	git notes add -m "topic note" topic &&
+	git notes add -m "unmodified note" unmodified &&
+	test_when_finished git notes remove topic unmodified &&
+	git range-diff --no-color master..topic master..unmodified \
+		>actual &&
+	sed s/Z/\ /g >expect <<-EOF &&
+	1:  $(test_oid t1) = 1:  $(test_oid u1) s/5/A/
+	2:  $(test_oid t2) = 2:  $(test_oid u2) s/4/A/
+	3:  $(test_oid t3) = 3:  $(test_oid u3) s/11/B/
+	4:  $(test_oid t4) ! 4:  $(test_oid u4) s/12/B/
+	    @@ Metadata
+	    Z
+	    Z ## Commit message ##
+	    Z    s/12/B/
+	    -    topic note
+	    +    unmodified note
+	    Z
+	    Z ## file ##
+	    Z@@ file: A
+	EOF
+	test_cmp expect actual
+'
+
+test_expect_success 'format-patch --range-diff compares notes by default' '
+	git notes add -m "topic note" topic &&
+	git notes add -m "unmodified note" unmodified &&
+	test_when_finished git notes remove topic unmodified &&
+	git format-patch --cover-letter --range-diff=$prev \
+		master..unmodified >actual &&
+	test_when_finished "rm 000?-*" &&
+	test_line_count = 5 actual &&
+	test_i18ngrep "^Range-diff:$" 0000-* &&
+	grep "= 1: .* s/5/A" 0000-* &&
+	grep "= 2: .* s/4/A" 0000-* &&
+	grep "= 3: .* s/11/B" 0000-* &&
+	grep "! 4: .* s/12/B" 0000-* &&
+	sed s/Z/\ /g >expect <<-EOF &&
+	    @@ Metadata
+	    Z
+	    Z ## Commit message ##
+	    Z    s/12/B/
+	    -    topic note
+	    +    unmodified note
+	    Z
+	    Z ## file ##
+	    Z@@ file: A
+	EOF
+	sed "/@@ Metadata/,/@@ file: A/!d" 0000-* >actual &&
+	test_cmp expect actual
+'
+
 test_done
-- 
2.24.0.450.g7a9a4598a9
Previous: Denton LiuNext: Denton Liu
Message 29 of 32 in “range-diff: don't compare notes”
  1. 0/3 range-diff: don't compare notesDenton Liu, Nov 19, 2019
  2. 1/3 t3206: remove spaces after redirect operatorsDenton Liu, Nov 19, 2019
  3. 2/3 t3206: demonstrate failure with notesDenton Liu, Nov 19, 2019
  4. Junio C HamanoNov 19, 2019
  5. 3/3 range-diff: use --no-notes to generate patchesDenton Liu, Nov 19, 2019
  6. Junio C HamanoNov 19, 2019
  7. 0/8 range-diff: learn `--notes`Denton Liu, Nov 19, 2019
  8. 1/8 argv-array: add space after `while`Denton Liu, Nov 19, 2019
  9. 2/8 rev-list-options.txt: remove reference to --show-notesDenton Liu, Nov 19, 2019
  10. 3/8 t3206: remove spaces after redirect operatorsDenton Liu, Nov 19, 2019
  11. Eric SunshineNov 20, 2019
  12. 4/8 t3206: s/expected/expect/Denton Liu, Nov 19, 2019
  13. 5/8 t3206: demonstrate current notes behaviorDenton Liu, Nov 19, 2019
  14. Junio C HamanoNov 20, 2019
  15. 6/8 range-diff: output `## Notes ##` headerDenton Liu, Nov 19, 2019
  16. 7/8 range-diff: passthrough --[no-]notes to `git log`Denton Liu, Nov 19, 2019
  17. Junio C HamanoNov 20, 2019
  18. Denton LiuNov 20, 2019
  19. Eric SunshineNov 21, 2019
  20. Denton LiuNov 21, 2019
  21. 8/8 format-patch: pass notes configuration to range-diffDenton Liu, Nov 19, 2019
  22. 00/10 range-diff: learn `--notes`Denton Liu, Nov 20, 2019
  23. 01/10 argv-array: add space after `while`Denton Liu, Nov 20, 2019
  24. 02/10 rev-list-options.txt: remove reference to --show-notesDenton Liu, Nov 20, 2019
  25. 03/10 pretty-options.txt: --notes accepts a ref instead of treeishDenton Liu, Nov 20, 2019
  26. 04/10 t3206: remove spaces after redirect operatorsDenton Liu, Nov 20, 2019
  27. 05/10 t3206: disable parameter substitution in heredocDenton Liu, Nov 20, 2019
  28. 06/10 t3206: s/expected/expect/Denton Liu, Nov 20, 2019
  29. 07/10 t3206: range-diff compares logs with commit notesDenton Liu, Nov 20, 2019
  30. 08/10 range-diff: output `## Notes ##` headerDenton Liu, Nov 20, 2019
  31. 09/10 range-diff: pass through --notes to `git log`Denton Liu, Nov 20, 2019
  32. 10/10 format-patch: pass notes configuration to range-diffDenton Liu, Nov 20, 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.