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

Re: [PATCH 2/2] format-patch: handle range-diff on notes correctly for single patches

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 22, 2025, 22:01 UTC
Message-ID
<xmqqecryrvt6.fsf@gitster.g>
In-Reply-To
<7f2487af433.1758574974.git.code@khaugsbakk.name>
kristofferhaugsbakk@fastmail.com writes:
Show 6 quoted lines
> From: Kristoffer Haugsbakk <code@khaugsbakk.name>
>
> No `--[no-]notes` options are sent to the range-diff subprocess in
> `range-diff.c` when making a single patch.  This means that you can get
> different Git notes below the commit message and in the range-diff
> part.  (See the previous commit for elaboration.)

Would this also mean "range-diff --no-notes" would not have any effect in squelching the note output in such a mode? If so, perhaps we should say not just "can get different Git notes" but "can get notes even when you asked not to"?

Show 40 quoted lines
> @@ -718,7 +718,8 @@ static void show_diff_of_diff(struct rev_info *opt)
>  			.creation_factor = opt->creation_factor,
>  			.dual_color = 1,
>  			.max_memory = RANGE_DIFF_MAX_MEMORY_DEFAULT,
> -			.diffopt = &opts
> +			.diffopt = &opts,
> +			.other_arg = &opt->rdiff_other_arg
>  		};
>  
>  		memcpy(&dq, &diff_queued_diff, sizeof(diff_queued_diff));
> diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh
> index e091df6d01d..1e812df806b 100755
> --- a/t/t3206-range-diff.sh
> +++ b/t/t3206-range-diff.sh
> @@ -707,7 +707,7 @@ test_expect_success 'format-patch --range-diff does not compare notes by default
>  	! grep "note" 0000-*
>  '
>  
> -test_expect_success 'format-patch --notes=custom --range-diff only compares custom notes' '
> +test_expect_success 'format-patch --notes=custom --range-diff --cover-letter only compares custom notes' '
>  	test_when_finished "git notes remove topic unmodified || :" &&
>  	git notes add -m "topic note" topic &&
>  	git notes add -m "unmodified note" unmodified &&
> @@ -721,6 +721,20 @@ test_expect_success 'format-patch --notes=custom --range-diff only compares cust
>  	! grep "## Notes ##" 0000-*
>  '
>  
> +# --range-diff on a single commit requires --no-cover-letter
> +test_expect_success 'format-patch --notes=custom --range-diff on single commit only compares custom notes' '
> +	test_when_finished "git notes remove HEAD unmodified || :" &&
> +	git notes add -m "topic note" HEAD &&
> +	test_when_finished "git notes --ref=custom remove HEAD unmodified || :" &&
> +	git notes add -m "unmodified note" unmodified &&
> +	git notes --ref=custom add -m "topic note (custom)" HEAD &&
> +	git notes --ref=custom add -m "unmodified note (custom)" unmodified &&
> +	git format-patch --notes=custom --range-diff=$prev \
> +		-1 --stdout >actual &&
> +	test_grep "## Notes (custom) ##" actual &&
> +	test_grep ! "## Notes ##" actual
> +'
Sounds sensible.
>  test_expect_success 'format-patch --range-diff with --no-notes' '
>  	test_when_finished "git notes remove topic unmodified || :" &&
>  	git notes add -m "topic note" topic &&
Previous: kristofferhaugsbakk@fastmail.comNext: Kristoffer Haugsbakk
Message 9 of 15 in “format-patch: handle range-diff on notes correctly for single patches”
  1. 0/2 format-patch: handle range-diff on notes correctly for single patcheskristofferhaugsbakk@fastmail.com, Sep 22, 2025
  2. 1/2 revision: add rdiff_other_arg to rev_infokristofferhaugsbakk@fastmail.com, Sep 22, 2025
  3. Junio C HamanoSep 22, 2025
  4. Kristoffer HaugsbakkSep 23, 2025
  5. Junio C HamanoSep 23, 2025
  6. Kristoffer HaugsbakkSep 23, 2025
  7. Junio C HamanoSep 23, 2025
  8. 2/2 format-patch: handle range-diff on notes correctly for single patcheskristofferhaugsbakk@fastmail.com, Sep 22, 2025
  9. Junio C HamanoSep 22, 2025
  10. Kristoffer HaugsbakkSep 23, 2025
  11. Junio C HamanoSep 23, 2025
  12. 0/3 format-patch: handle range-diff on notes correctly for single patcheskristofferhaugsbakk@fastmail.com, Sep 25, 2025
  13. 1/3 range-diff: rename other_arg to log_argkristofferhaugsbakk@fastmail.com, Sep 25, 2025
  14. 2/3 revision: add rdiff_log_arg to rev_infokristofferhaugsbakk@fastmail.com, Sep 25, 2025
  15. 3/3 format-patch: handle range-diff on notes correctly for single patcheskristofferhaugsbakk@fastmail.com, Sep 25, 2025

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.