git@vger.kernel.org list mirror (unofficial, 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

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git