joey@darkstar:/tmp>git init test
Initialized empty Git repository in /tmp/test/.git/
joey@darkstar:/tmp>cd test
joey@darkstar:/tmp/test>mkdir sub
joey@darkstar:/tmp/test>cd sub
joey@darkstar:/tmp/test/sub>GIT_INDEX_FILE=../.git/otherindex git write-tree
fatal: Unable to create '/tmp/test/../.git/otherindex.lock': No such file or 
directory

Appears to be a bug in git. Seems that it's assuming GIT_INDEX_FILE is
relative to the top of the worktree and not to the CWD.

Workaround: Use absolute path to the index file.

joey@darkstar:/tmp/test/sub>GIT_INDEX_FILE=`pwd`/../.git/otherindex git 
write-tree
4b825dc642cb6eb9a060e54bf8d69288fbee4904
joey@darkstar:/tmp/test/sub>ls ../.git/otherindex 
../.git/otherindex

git version 2.8.1

-- 
see shy jo

Attachment: signature.asc
Description: PGP signature

Reply via email to