git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* GIT_DIR not passed to script if hooksPath is set
@ 2019-04-01 14:14 Jan Ziak
  0 siblings, 0 replies; only message in thread
From: Jan Ziak @ 2019-04-01 14:14 UTC (permalink / raw)
  To: Git Mailing List

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

Hello

If git commit executes .git/hooks/post-commit it will pass GIT_DIR env
variable to the script. However, if hooksPath is set in
$HOME/.gitconfig, git commit executes hooksPath/post-commit without
passing GIT_DIR env variable to the script.

Expected behavior: GIT_DIR is passed to hooksPath/post-commit
Actual behavior: GIT_DIR isn't passed to hooksPath/post-commit

Please run the attached shell script in an empty directory to
reproduce this issue. The script is using strace to determine whether
GIT_DIR is passed to the hook script. 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. The script is exploiting the
fact that (currently) command-line "git commit" and graphical "git
gui" commit are invoking different commit hooks.

Script output:
  - !!! missing GIT_DIR in git-commit.strace
  - execve(".git/hooks/post-commit", [... "GIT_DIR=.git" ...

$ 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] only message in thread

only message in thread, other threads:[~2019-04-01 14:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-01 14:14 GIT_DIR not passed to script if hooksPath is set 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