From: Jan Ziak <0xe2.0x9a.0x9b@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Subject: GIT_DIR not passed to script if hooksPath is set
Date: Mon, 1 Apr 2019 16:14:16 +0200 [thread overview]
Message-ID: <CAODFU0osBF5RCe-gwEJiPOd90nqdnFycmWSEq-2EaLVQMeRpcw@mail.gmail.com> (raw)
[-- 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 --]
reply other threads:[~2019-04-01 14:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAODFU0osBF5RCe-gwEJiPOd90nqdnFycmWSEq-2EaLVQMeRpcw@mail.gmail.com \
--to=0xe2.0x9a.0x9b@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).