Web lists-archives.com

git-gui: executed hooks are different from command-line git if hooksPath is set




Hello

Command-line "git commit" and graphical "git gui" commit are invoking
different hooks if hooksPath is set in $HOME/.gitconfig.

Namely, in my case command-line "git commit" runs
"/home/atom/dev/git-hooks/post-commit" - while "git gui" commit runs
".git/hooks/post-commit".

Please run the attached shell script in an empty directory to
reproduce this issue. The script is using strace to determine which
hook is being executed. The script will run "git gui": the user is
expected to simply commit changes from the gui and then close the gui
for the script to finish.

Script output:
  command-line: access("/home/atom/dev/git-hooks/post-commit", X_OK)
  gui: access(".git/hooks/post-commit", X_OK)

$ cat ~/.gitconfig
[core]
    hooksPath = /home/atom/dev/git-hooks

git version 2.21.0

Sincerely
Jan

Attachment: a.sh
Description: application/shellscript