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

[PATCH] git-gui: do not exit upon prepare-commit-msg hook failure

From
ALAnthony Loiseau <anthony@loiseau.fr>
Date
Jul 11, 2024, 13:25 UTC
Message-ID
<20240711132542.9792-1-anthony@loiseau.fr>

Targeted issue ==============

git-gui is currently unusable when prepare-commit-msg hook fails, since it closes as soon as user dismiss modal error popup shown on start.

Proposal ========

Next mail is a proposal to make this failure non-fatal. Popup is still shown but not in its fatal variant (which removes the "you must fix this before commiting" unwanted sentence), and git-gui is not terminated upon popup dismiss.

With this proposal, user is clearly aware of a prepare-commit-msg hook failure but is not denied to use git-gui and can even commit. Pre-filled commit message content is likely empty or not filled in this case, which is not a big issue.

Other hooks are not affected. commit-msg hook and next ones are still triggered upon commit action, telling commit can not be performed (fatal variant of the popup) without terminating git-gui upon dismiss.

How to test ===========

cat > .git/hooks/fake_failing_hook <<EOF #!/bin/sh echo 'FAKE FAILING HOOK $0' >&2 exit 1 EOF

for i in .git/hooks/*.sample
do
	ln -svf fake_failing_hook "${i%%.sample}"
done

chmod u+x .git/hooks/* rm .git/GITGUI_MSG git gui

Anthony Loiseau (1):
  git-gui: do not exit upon prepare-commit-msg hook failure
 git-gui/git-gui.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
-- 
2.45.2
Next: Anthony Loiseau
Message 1 of 4 in “git-gui: do not exit upon prepare-commit-msg hook failure”
  1. git-gui: do not exit upon prepare-commit-msg hook failureAnthony Loiseau, Jul 11, 2024
  2. git-gui: do not exit upon prepare-commit-msg hook failureAnthony Loiseau, Jul 11, 2024
  3. Johannes SixtJul 13, 2024
  4. Eric SunshineJul 11, 2024

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.