From: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
To: Johannes Sixt <j6t@kdbg.org>
Cc: Brian Lyles <brianmlyles@gmail.com>,
Junio C Hamano <gitster@pobox.com>,
Eric Sunshine <sunshine@sunshineco.com>,
git@vger.kernel.org, Sean Allred <allred.sean@gmail.com>
Subject: Re: [BUG REPORT] git-gui invokes prepare-commit-msg hook incorrectly
Date: Wed, 7 Aug 2024 20:19:32 +0200 [thread overview]
Message-ID: <ZrO6tM0fZLly1bPA@ugly> (raw)
In-Reply-To: <ab9824ee-65e1-4e4b-b739-205f2c5d24fe@kdbg.org>
On Mon, Jul 08, 2024 at 10:40:19PM +0200, Johannes Sixt wrote:
>Am 08.07.24 um 21:29 schrieb Brian Lyles:
>> Could you elaborate on why git-gui's commit message edit box should
>> behave differently than any other commit message editor? Why is there no
>> concept as "comment lines" in git-gui?
>
>First of all, Git GUI is not a commit message editor, not even in its
>git citool incarnation. You cannot instruct git commit to use it as
>message editor.
>
nobody suggested that.
>Consider the commit message that git commit presents in the editor. It
>contains the message text, instructions about how to use the tool, a
>list of files, and sometimes even patch text.
>
>Git GUI does that, too: There is the part where the message is entered,
>there is a list or two of files, and there is patch text. (OK, there are
>no instructions.) What the user writes into the part for the message
>text must go into the commit. Except that the git commit's message
>editor has a limitation: it can't tell the subsequent post processing
>with absolute certainty which text is message text due to the possible
>comment lines.
>
>Git GUI can offer this certainty because its
>corresponding section is a dedicated text edit box.
>
no, it can't, as others already pointed out. the attempt to structure
the info is woefully incomplete, pretty much inherently. the text-based
workflow is just "too core" to have interactive frontends deviate from
it. not presenting and interpreting the text as "real" git would will
always be a source of problems, regardless of how many workarounds are
added.
i'll note that the qt creator ide as an example of a git frontend does
strip the message.
>> I think that whatever path forward is taken, it needs to be predictable
>> and consistent with normal `git commit` behaviors. I think that's the
>> root problem here in my mind: From the perspective of the
>> prepare-commit-msg hook, it's impossible to do the right thing because
>> git-gui is invoking the hook consistent with normal `git commit`
>> behaviors, but then creating the commit with `git commit -F` behaviors.
>> This is an inconsistency with git-gui specifically.
>
>Good that you point that out. Git GUI does the wrong thing here. It
>should really request the form corresponding to git commit -F. The
>second option that you suggest looks correct to me:
>
firstly, there is no parameter which would actually tell it whether the
message will be stripped. the 'message' token is unreliable for this
purpose, as -F merely imposes a default on [-no]-edit and thereby
--cleanup.
secondly, it seems a bit optimistic to expect that the hook would
actually implement different output modes.
>> So it still seems like we have two real options:
>>
>> - Start washing the message, allowing the prepare-commit-msg hook to
>> provide template-like guidance to the user regardless of if they are
>> using git-gui or some other editor, or
>> - Pass the "message" argument along to the prepare-commit-msg hook so
>> that it can at least avoid adding template-like content (but of course
>> then lose the value added by that template).
>
i'm strongly in favor of the first option.
it also seems to be the much easier one to implement.
prev parent reply other threads:[~2024-08-07 18:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-05 19:23 [BUG REPORT] git-gui invokes prepare-commit-msg hook incorrectly brianmlyles
2024-07-05 19:57 ` Eric Sunshine
2024-07-05 20:56 ` Sean Allred
2024-07-05 21:47 ` Eric Sunshine
2024-07-06 14:03 ` Johannes Sixt
2024-07-06 18:15 ` Junio C Hamano
2024-07-07 13:25 ` Johannes Sixt
2024-07-08 19:29 ` Brian Lyles
2024-07-08 20:40 ` Johannes Sixt
2024-08-07 18:19 ` Oswald Buddenhagen [this message]
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=ZrO6tM0fZLly1bPA@ugly \
--to=oswald.buddenhagen@gmx.de \
--cc=allred.sean@gmail.com \
--cc=brianmlyles@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j6t@kdbg.org \
--cc=sunshine@sunshineco.com \
/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.