{"thread":{"id":"50854","subject":"GIT_DIR not passed to script if hooksPath is set","startedAt":"2019-04-01T14:14:30Z","lastAt":"2019-04-01T14:14:30Z","messageCount":1,"participants":["Jan Ziak"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"372891","messageId":"CAODFU0osBF5RCe-gwEJiPOd90nqdnFycmWSEq-2EaLVQMeRpcw@mail.gmail.com","threadId":"50854","inReplyTo":null,"subject":"GIT_DIR not passed to script if hooksPath is set","fromName":"Jan Ziak","fromEmail":"0xe2.0x9a.0x9b@gmail.com","sentAt":"2019-04-01T14:14:16Z","receivedAt":"2019-04-01T14:14:30Z","isPatch":false,"sender":{"key":"0xe2.0x9a.0x9b@gmail.com","avatar":"https://gravatar.com/avatar/f5c8ab1a4a405f877f5caf23a7105cae64785ae147161b93922c6e26020be3e5?d=mp&s=160"},"body":"Hello\n\nIf git commit executes .git/hooks/post-commit it will pass GIT_DIR env\nvariable to the script. However, if hooksPath is set in\n$HOME/.gitconfig, git commit executes hooksPath/post-commit without\npassing GIT_DIR env variable to the script.\n\nExpected behavior: GIT_DIR is passed to hooksPath/post-commit\nActual behavior: GIT_DIR isn't passed to hooksPath/post-commit\n\nPlease run the attached shell script in an empty directory to\nreproduce this issue. The script is using strace to determine whether\nGIT_DIR is passed to the hook script. The script will run \"git gui\":\nthe user is expected to simply commit changes from the gui and then\nclose the gui for the script to finish. The script is exploiting the\nfact that (currently) command-line \"git commit\" and graphical \"git\ngui\" commit are invoking different commit hooks.\n\nScript output:\n  - !!! missing GIT_DIR in git-commit.strace\n  - execve(\".git/hooks/post-commit\", [... \"GIT_DIR=.git\" ...\n\n$ cat ~/.gitconfig\n[core]\n    hooksPath = /home/atom/dev/git-hooks\n\ngit version 2.21.0\n\nSincerely\nJan\n"}]}