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

Re: [PATCH] git-gui: remove lines starting with the comment character

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Feb 3, 2021, 17:48 UTC
Message-ID
<CAPig+cTQaPTNnGcd583B=xoVUR1qPb372Y_x9szROfMcA5h+tA@mail.gmail.com>
In-Reply-To
<fdfe1661-463b-fc18-02cc-4c6e22ce0463@kdbg.org>
On Wed, Feb 3, 2021 at 12:35 PM Johannes Sixt <j6t@kdbg.org> wrote:
Show 17 quoted lines
> Am 02.02.21 um 21:03 schrieb Pratyush Yadav:
> > The comment character is specified by the config variable
> > 'core.commentchar'. Any lines starting with this character is considered
> > a comment and should not be included in the final commit message.
> >
> > Teach git-gui to filter out lines in the commit message that start with
> > the comment character. If the config is not set, '#' is taken as the
> > default.
>
> This is WRONG. Git GUI is that: a GUI, it's all about WYSIWYG. If you do
> not give sufficient unambiguous visual clue to the user that certain
> lines will be ignored, you cannot ignore them.
>
> Perhaps what you are really only interested in is to remove the list of
> conflicted files after a merge conflict? Then the correct way to proceed
> would be to sanitize the contents of .git/MERGE_MSG before it is
> inserted into the edit box.

This is indeed the case I run into which is annoying because the commented-out list of conflicted files does not get removed when git-gui performs the actual commit.

However, although what you propose here seems superficially enticing, it doesn't mirror the behavior of git-commit itself when launching an editor, in which case the unsanitized file (containing the commented-out conflicted file list) is loaded into the editor verbatim, and it is only sanitized when the edit session is finished. The important difference is that extra text is added to the edit buffer telling the user explicitly that "lines beginning with '#' will be ignored".

So, perhaps one way forward is for Pratyush to emulate that behavior and insert some text into the edit box saying "lines beginning with '#' will be ignored", or add a label above or below the edit box stating the same. (Of course, the actual displayed comment-character should be determined dynamically.)

Previous: Johannes SixtNext: Eric Sunshine
Message 5 of 8 in “git-gui: remove lines starting with the comment character”
  1. git-gui: remove lines starting with the comment characterPratyush Yadav, Feb 2, 2021
  2. Eric SunshineFeb 2, 2021
  3. Pratyush YadavFeb 3, 2021
  4. Johannes SixtFeb 3, 2021
  5. Eric SunshineFeb 3, 2021
  6. Eric SunshineFeb 3, 2021
  7. Johannes SixtFeb 3, 2021
  8. Pratyush YadavFeb 3, 2021

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.