All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Aaron Schrab <aaron@schrab.com>
Cc: git@vger.kernel.org,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Daniel Harding <dharding@living180.net>
Subject: Re: [PATCH 0/2] Fix --rebase-merges with custom commentChar
Date: Thu, 12 Jul 2018 10:15:47 -0700	[thread overview]
Message-ID: <xmqq4lh4z870.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180712030249.22071-1-aaron@schrab.com> (Aaron Schrab's message of "Wed, 11 Jul 2018 23:02:49 -0400")

Aaron Schrab <aaron@schrab.com> writes:

> 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?

> 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");

  reply	other threads:[~2018-07-12 17:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-08 18:41 [PATCH 0/2] Fix --rebase-merges with custom commentChar Daniel Harding
2018-07-08 18:41 ` [PATCH 1/2] sequencer: fix " Daniel Harding
2018-07-08 18:41 ` [PATCH 2/2] t3430: update to test " Daniel Harding
2018-07-08 21:02   ` brian m. carlson
2018-07-09  7:52     ` Johannes Schindelin
2018-07-09 16:46       ` Junio C Hamano
2018-07-09 18:22       ` Daniel Harding
2018-07-09 19:09         ` Johannes Schindelin
2018-07-09 20:05         ` Junio C Hamano
2018-07-09 18:48     ` Daniel Harding
2018-07-09 19:14       ` Johannes Schindelin
2018-07-10 12:29         ` Daniel Harding
2018-07-10 13:08           ` Johannes Schindelin
2018-07-10 13:49             ` Daniel Harding
2018-10-02 14:38               ` Johannes Schindelin
2018-07-09 23:41       ` brian m. carlson
2018-07-09  7:53 ` [PATCH 0/2] Fix --rebase-merges " Johannes Schindelin
2018-07-10 13:24   ` Daniel Harding
2018-07-12  3:02     ` Aaron Schrab
2018-07-12 17:15       ` Junio C Hamano [this message]
2018-07-16  4:59         ` [PATCH v3] sequencer: use configured comment character Aaron Schrab
2018-07-16 15:59           ` Johannes Schindelin
2018-07-16 18:49             ` Daniel Harding
2018-07-17 16:46               ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq4lh4z870.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=aaron@schrab.com \
    --cc=dharding@living180.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.