Re: [BUG REPORT] git-gui invokes prepare-commit-msg hook incorrectly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

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.

> 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:

> 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).

-- Hannes





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux