# [PATCH] sequencer: use configured comment character

5 messages from 2018-06-28 to 2018-06-29. Participants: Aaron Schrab, Johannes Schindelin, Junio C Hamano.
Thread: https://gitlist.dev/t/48793

## Aaron Schrab, 2018-06-28 02:04

Subject: [PATCH] sequencer: use configured comment character
Message-ID: <20180628020414.25036-1-aaron@schrab.com>
URL: https://gitlist.dev/e/20180628020414.25036-1-aaron%40schrab.com

```
Use configured comment character when generating comments about branches
in an instruction sheet.  Failure to honor this configuration causes a
failure to parse the resulting instruction sheet.

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");
 
-- 
2.18.0.419.gfe4b301394


```

## Johannes Schindelin, 2018-06-28 09:57

Subject: Re: [PATCH] sequencer: use configured comment character
Message-ID: <nycvar.QRO.7.76.6.1806281157110.73@tvgsbejvaqbjf.bet>
URL: https://gitlist.dev/e/nycvar.QRO.7.76.6.1806281157110.73%40tvgsbejvaqbjf.bet
In-Reply-To: <20180628020414.25036-1-aaron@schrab.com>

```
Hi Aaron,

On Wed, 27 Jun 2018, Aaron Schrab wrote:

> Use configured comment character when generating comments about branches
> in an instruction sheet.  Failure to honor this configuration causes a
> failure to parse the resulting instruction sheet.

Good catch.

Now, if you can refer to the "todo list" as "todo list" (or "todo script"
if you must) instead of an "instruction sheet", you have my ACK.

Ciao,
Johannes

```

## Junio C Hamano, 2018-06-28 20:38

Subject: Re: [PATCH] sequencer: use configured comment character
Message-ID: <xmqqh8lmwsso.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqqh8lmwsso.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <20180628020414.25036-1-aaron@schrab.com>

```
Aaron Schrab <aaron@schrab.com> writes:

> Use configured comment character when generating comments about branches
> in an instruction sheet.  Failure to honor this configuration causes a
> failure to parse the resulting instruction sheet.
>
> 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");

Would this interact OK with core.commentchar set to "auto"?

```

## Johannes Schindelin, 2018-06-29 14:12

Subject: Re: [PATCH] sequencer: use configured comment character
Message-ID: <nycvar.QRO.7.76.6.1806291607501.74@tvgsbejvaqbjf.bet>
URL: https://gitlist.dev/e/nycvar.QRO.7.76.6.1806291607501.74%40tvgsbejvaqbjf.bet
In-Reply-To: <xmqqh8lmwsso.fsf@gitster-ct.c.googlers.com>

```
Hi Junio,

On Thu, 28 Jun 2018, Junio C Hamano wrote:

> Aaron Schrab <aaron@schrab.com> writes:
> 
> > Use configured comment character when generating comments about branches
> > in an instruction sheet.  Failure to honor this configuration causes a
> > failure to parse the resulting instruction sheet.
> >
> > 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");
> 
> Would this interact OK with core.commentchar set to "auto"?

The idea of "auto" is:

	If set to "auto", `git-commit` would select a character that is not
	the beginning character of any line in existing commit messages.

As there are no pre-existing lines in that script (apart from the ones we
are about to add with the todo_help), the setting "auto" is pretty moot
and we will fall back to the default comment char (or, if there was a
previous core.commentChar that was parsed, that one).

In short: the code is fine, but yes, I had to convince myself by looking
through the code. (Hinting at a possible improvement of the commit
message.)

Ciao,
Dscho

```

## Junio C Hamano, 2018-06-29 15:56

Subject: Re: [PATCH] sequencer: use configured comment character
Message-ID: <xmqq8t6xwpr7.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqq8t6xwpr7.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <nycvar.QRO.7.76.6.1806291607501.74@tvgsbejvaqbjf.bet>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> In short: the code is fine, but yes, I had to convince myself by looking
> through the code. (Hinting at a possible improvement of the commit
> message.)

Yup, that exactly was what I was hoping readers to realize.

```
