git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git-gui: executed hooks are different from command-line git if hooksPath is set
@ 2019-04-01 13:57 Jan Ziak
  2019-04-01 20:46 ` Johannes Schindelin
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Ziak @ 2019-04-01 13:57 UTC (permalink / raw)
  To: Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 808 bytes --]

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 #2: a.sh --]
[-- Type: application/x-shellscript, Size: 821 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: git-gui: executed hooks are different from command-line git if hooksPath is set
  2019-04-01 13:57 git-gui: executed hooks are different from command-line git if hooksPath is set Jan Ziak
@ 2019-04-01 20:46 ` Johannes Schindelin
  2019-04-02 23:35   ` Jan Ziak
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Schindelin @ 2019-04-01 20:46 UTC (permalink / raw)
  To: Jan Ziak; +Cc: Git Mailing List

Hi Jan,

On Mon, 1 Apr 2019, Jan Ziak wrote:

> 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

Could you give `master` of https://github.com/git-for-windows/git a try?
(Despite the name, we aim to keep it functional on the same platforms as
Git itself.)

I am fairly certain that I fixed it there, and contributed a PR to the Git
GUI project, but it seems that that project is in a kind of hibernating
state right now.

Ciao,
Johannes

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: git-gui: executed hooks are different from command-line git if hooksPath is set
  2019-04-01 20:46 ` Johannes Schindelin
@ 2019-04-02 23:35   ` Jan Ziak
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Ziak @ 2019-04-02 23:35 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Git Mailing List

On Mon, 1 Apr 2019 at 22:46, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Could you give `master` of https://github.com/git-for-windows/git a try?
> (Despite the name, we aim to keep it functional on the same platforms as
> Git itself.)
>
> I am fairly certain that I fixed it there, and contributed a PR to the Git
> GUI project, but it seems that that project is in a kind of hibernating
> state right now.

Hello Johannes

You are right. git-gui.sh in `master` of
https://github.com/git-for-windows/git is respecting the hooksPath
specified in ~/.gitconfig.

Executing "git-for-windows/git rev-parse --git-path hooks/post-commit"
as part of the process works fine but it seems a bit inefficient.

Sincerely
Jan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-02 23:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-01 13:57 git-gui: executed hooks are different from command-line git if hooksPath is set Jan Ziak
2019-04-01 20:46 ` Johannes Schindelin
2019-04-02 23:35   ` Jan Ziak

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).