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

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

 



Hi Johannes,

Johannes Sixt <j6t@xxxxxxxx> wrote:
> My take-away is:
>
> - The commit message that is entered in the edit box must appear in the
>   commit unmodified. There is no such concept as "comment lines" in git
>   gui's commit message edit box. The commit-msg hook can overrule
>   nevertheless as a means to enforce message hygiene, but otherwise the
>   user must have full authority.

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?

Johannes Sixt <j6t@xxxxxxxx> wrote:
> - A commit message template and the MERGE_MSG file are populated in a
> manner that is suitable for `git commit`, i.e. can (and do) contain
> comment lines. It is, therefore, necessary to remove them when their
> text is used to populate git gui's edit box.

> I suggest that removing comment lines ("message-washing") should not
> happen as a post-processing step, but as a preprocessing step when text
> is gathered from particular sources that are known to contain
> inessential cruft.

While I agree in theory that it would be ideal for git-gui to wash only
content from sources that are known to contain content meant to be
washed, but I don't think that's possible since git-gui can't possibly
know *why* a given line appears in the message, in particular when
running the prepare-commit-msg hook.

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.

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

The former seems most intuitive to me, though I have admittedly little
context for git-gui. Hopefully the elaboration I requested further up in
this message will shed some light things if you still disagree with
washing the message.

I'm certainly open to other ideas as well so long as they allow the hook
author the ability to add comments when the message will be washed and
not add comments when it won't be washed, regardless of whether git-gui
is in use.

-- 
Thank you,
Brian Lyles




[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