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

Re: [PATCH] sequencer: remove use of comment character

From
Elijah Newren <newren@gmail.com>
Date
Oct 31, 2023, 06:20 UTC
Message-ID
<CABPp-BFY7m_g+sT131_Ubxqo5FsHGKOPMng7=90_0-+xCS9NEQ@mail.gmail.com>
In-Reply-To
<xmqqcywv4ar2.fsf@gitster.g>
On Mon, Oct 30, 2023 at 10:33 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 26 quoted lines
>
> Junio C Hamano <gitster@pobox.com> writes:
>
> > Elijah Newren <newren@gmail.com> writes:
> >
> >> I thought the point of the comment_line_char was so that commit
> >> messages could have lines starting with '#'.  That rationale doesn't
> >> apply to the TODO list generation or parsing, and I'm not sure if we
> >> want to add the same complexity there.
>
> Earlier I said
>
> > Thanks for a healthy dose of sanity.  I noticed existing use of
> > comment_line_char everywhere in sequencer.c and assumed we would
> > want to be consistent, but you are right to point out that they are
> > all about the COMMIT_EDITMSG kind of thing, and not about what
> > appears in "sequencer/todo".
>
> but with something as simple as
>
>     $ git -c core.commentchar='@' rebase -i master seen^2
>
> I can see that the references to comment_line_char in sequencer.c
> are about the commented lines after the list of insn in the
> generated sequencer/todo file, so even though the rationale does not
> apply, isn't this already "broken" in the current code anyway?

Yes, I believe it is. However, I remember specifically looking at cases with --rebase-merges about a year and a half ago, and noted that there was a mixture of hardcoded '#' references along with comment_line_char. I noted at the time that changing comment_line_char looked like it had a bug, and that the parsing in particular would be fooled and do wrong things if it changed. Unfortunately, I can't find any notes from the time with the details, so I don't remember exactly what or how it was triggered.

However, I do suspect that the references to comment_line_char in the `rebase -i` codepaths was not for any actual intended purpose, but just noting that they were used elsewhere in the file (for COMMIT_EDITMSG, where it made sense) and just mimicking that code without realizing the lack of rationale. That would have been mere wasted effort had the comment_line_char been consistently supported in the TODO file editing and parsing, but it wasn't, which left TODO editing & parsing somewhat broken.

I think supporting comment_line_char for the TODO file provides no value, and I think the easier fix would be undoing the uses of comment_line_char relative to the TODO file (perhaps also leaving in-code comments to the effect that comment_line_char just doesn't apply to the TODO file).

However, if someone prefers to make the TODO file also respect
comment_line_char, despite its dubious value, then I expect any patch
should
  1) audit *every* reference found via git grep -e '".*#' -e "'#'" sequencer.c
  2) add a test case (or cases) involving --rebase-merges -i that
trigger the relevant code paths
If they don't do that, then I fear we might make the bug more likely
to be triggered rather than less.
Previous: Junio C HamanoNext: Tony Tung via GitGitGadget
Message 8 of 18 in “sequencer: remove use of comment character”
  1. sequencer: remove use of comment characterTony Tung via GitGitGadget, Oct 30, 2023
  2. Junio C HamanoOct 30, 2023
  3. Elijah NewrenOct 30, 2023
  4. Junio C HamanoOct 30, 2023
  5. Tony TungOct 31, 2023
  6. Tony TungOct 31, 2023
  7. Junio C HamanoOct 31, 2023
  8. Elijah NewrenOct 31, 2023
  9. 0/2 sequencer: remove use of hardcoded comment charTony Tung via GitGitGadget, Oct 31, 2023
  10. 1/2 sequencer: remove use of comment characterTony Tung via GitGitGadget, Oct 31, 2023
  11. Phillip WoodOct 31, 2023
  12. Junio C HamanoNov 1, 2023
  13. 2/2 sequencer: fix remaining hardcoded comment charTony Tung via GitGitGadget, Oct 31, 2023
  14. Phillip WoodOct 31, 2023
  15. Elijah NewrenOct 31, 2023
  16. Phillip WoodOct 31, 2023
  17. Junio C HamanoNov 1, 2023
  18. Elijah NewrenNov 1, 2023

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.