Skip to contentSkip to conversation

sequencer: use configured comment character

PATCH Superseded Aaron Schrab 3 participants 5 messages Jun 28, 2018 – Jun 29, 2018

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sequencer: use configured comment character

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.

---
 sequencer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sequencer.c +1 -1
index 4034c0461b..caf91af29d 100644
@@ -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");
 
Signature · 1 line
2.18.0.419.gfe4b301394
#1 lore raw

Hi Aaron,

Quoted 3 lines · Aaron Schrab

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

#2 lore raw
In reply to Aaron Schrab
Quoted 14 lines · Aaron Schrab

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.

---
 sequencer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sequencer.c +0 -0
index 4034c0461b..caf91af29d 100644

sequencer.c static int make_script_with_merges(struct pretty_print_context *pp, · line 3996

Quoted 7 lines
sequencer.c +1 -1
@@ -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"?

#3 lore raw

Hi Junio,

Quoted 18 lines · Junio C Hamano
Quoted 16 lines · Aaron Schrab

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.

---
 sequencer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sequencer.c +0 -0
index 4034c0461b..caf91af29d 100644
@@ -3991,7 +3991,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,
 		entry = oidmap_get(&state.commit2label, &commit->object.oid);
 
Quoted 7 lines

sequencer.c static int make_script_with_merges(struct pretty_print_context *pp, · line 3996

Quoted 5 lines
sequencer.c +1 -1
 		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

#4 lore raw
Quoted 3 lines · Johannes Schindelin

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.