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

Re: [PATCH 0/2] Fix --rebase-merges with custom commentChar

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 12, 2018, 17:15 UTC
Message-ID
<xmqq4lh4z870.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180712030249.22071-1-aaron@schrab.com>
Aaron Schrab <aaron@schrab.com> writes:
Show 5 quoted lines
> Subject: [PATCH v2] sequencer: use configured comment character
>
> Use the configured comment character when generating comments about
> branches in a todo list.  Failure to honor this configuration causes a
> failure to parse the resulting todo list.
OK.
>
> Note that the comment_line_char has already been resolved by this point,
> even if the user has configured the comment character to be selected
> automatically.
Isn't this a slight lie?

The core.commentchar=auto setting is noticed by everybody (including the users of the sequencer machinery), but it is honored only by builtin/commit.c::prepare_to_commit() that is called by builtin/commit.c::cmd_commit(), i.e. the implementation of "git commit" that should not be used as a subroutine by other commands, and by nothing else. If the user has core.commentchar=auto, the comment_line_char is left to the default '#' in the sequencer codepath.

I think the patch is still correct and safe, but the reason why it is so is not because we chose a suitable character (that is how I read what "has already been resolved by this point" means) by calling builtin/commit.c::adjust_comment_line_char(). Isn't it because the "script" the function is working on does not have a line that came from arbitrary end-user input that may happen to begin with '#', hence the default '#' is safe to use?

Show 17 quoted lines
> Signed-off-by: Aaron Schrab <aaron@schrab.com>
> ---
>  sequencer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sequencer.c b/sequencer.c
> index 4034c0461b..caf91af29d 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -3991,7 +3991,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,
>  		entry = oidmap_get(&state.commit2label, &commit->object.oid);
>  
>  		if (entry)
> -			fprintf(out, "\n# Branch %s\n", entry->string);
> +			fprintf(out, "\n%c Branch %s\n", comment_line_char, entry->string);
>  		else
>  			fprintf(out, "\n");
Previous: Aaron SchrabNext: Aaron Schrab
Message 20 of 24 in “Fix --rebase-merges with custom commentChar”
  1. 0/2 Fix --rebase-merges with custom commentCharDaniel Harding, Jul 8, 2018
  2. 1/2 sequencer: fix --rebase-merges with custom commentCharDaniel Harding, Jul 8, 2018
  3. 2/2 t3430: update to test with custom commentCharDaniel Harding, Jul 8, 2018
  4. brian m. carlsonJul 8, 2018
  5. Johannes SchindelinJul 9, 2018
  6. Junio C HamanoJul 9, 2018
  7. Daniel HardingJul 9, 2018
  8. Johannes SchindelinJul 9, 2018
  9. Junio C HamanoJul 9, 2018
  10. Daniel HardingJul 9, 2018
  11. Johannes SchindelinJul 9, 2018
  12. Daniel HardingJul 10, 2018
  13. Johannes SchindelinJul 10, 2018
  14. Daniel HardingJul 10, 2018
  15. Johannes SchindelinOct 2, 2018
  16. brian m. carlsonJul 9, 2018
  17. Johannes SchindelinJul 9, 2018
  18. Daniel HardingJul 10, 2018
  19. Aaron SchrabJul 12, 2018
  20. Junio C HamanoJul 12, 2018
  21. sequencer: use configured comment characterAaron Schrab, Jul 16, 2018
  22. Johannes SchindelinJul 16, 2018
  23. Daniel HardingJul 16, 2018
  24. Johannes SchindelinJul 17, 2018

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.