Re: Problem with environment of hook execution when git is run with --work-tree / --git-dir

2017-11-26 Thread Michael Sloan
On Sun, Nov 26, 2017 at 5:16 PM, Junio C Hamano wrote: > Michael Sloan writes: > >> So what's the problem with this choice of environment variables? >> Well, the problem is that if PWD is changed during the execution of >> the script, then GIT_WORK_TREE and

Re: Problem with environment of hook execution when git is run with --work-tree / --git-dir

2017-11-26 Thread Junio C Hamano
Michael Sloan writes: > So what's the problem with this choice of environment variables? > Well, the problem is that if PWD is changed during the execution of > the script, then GIT_WORK_TREE and GIT_DIR will no longer work > properly. For example, if the pre-commit hook is >

Problem with environment of hook execution when git is run with --work-tree / --git-dir

2017-11-25 Thread Michael Sloan
Hi! I noticed a potential bug with the invocation of a pre-commit hook when running git with --work-tree and --git-dir. In particular, I was investigating how hooks can still run git commands properly even when the work-tree or git-dir is overridden via CLI args. I put the following in