Re: Git clone fails during pre-commit hook due to GIT_WORK_TREE=. (regression 2.5 -> 2.6)
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Nov 25, 2015, 20:13 UTC
- Message-ID
- <CACsJy8C7xoV9faGpbn_5XGt-CmCj--fgXaCFR-ngs=-pWUnrCA@mail.gmail.com>
- In-Reply-To
- <CAGZ79kY=t9SeoXjgeJjfCMD2=6g3JJxDxcnY6JeJCpUqaN+eOA@mail.gmail.com>
On Tue, Nov 24, 2015 at 6:57 PM, Stefan Beller <sbeller@google.com> wrote:
Show 9 quoted lines
> +to Nguyễn Thái Ngọc Duy <pclouds@gmail.com> > > On Mon, Nov 23, 2015 at 6:22 PM, Anthony Sottile <asottile@umich.edu> wrote: >> * Short description of the problem * >> >> It seems GIT_WORK_DIR is now exported invariantly when calling git >> hooks such as pre-commit. If these hooks involve cloning repositories >> they will not fail due to this exported environment variable. This >> was not the case in prior versions (such as v2.5.0).
I'm getting good at fixing one bug and adding ten more. I don't think the cited commit is the problem. It just exposes another bug. I did
> ~/w/git $ GIT_WORK_TREE=abc ./git clone .git /tmp/def
and what I got was really surprising, /tmp/def contains the git repository while the true worktree is in "abc". It does not make sense, at least from the first sight, unless it inherits this from git-init, where we do(?) want GIT_WORK_TREE to specify a separate worktree. No time to dig to the bottom yet..
-- Duy