This is actually worse than I thought; when git is being run with a detached work tree, GIT_INDEX_FILE is treated as a path relative to CWD, instead of the normal behavior of relative the top of the work tree.
Normal and expected (according to this thread anyway): joey@darkstar:~/src/other/git/Documentation> input="100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1 frotz" joey@darkstar:~/src/other/git/Documentation> echo "$input" | GIT_INDEX_FILE=.git/newindex git update-index --index-info joey@darkstar:~/src/other/git/Documentation> ls ../.git/newindex ../.git/newindex Fully detached worktree and git dir: joey@darkstar:/> echo "$input" | GIT_INDEX_FILE=.git/index git --git-dir=/home/joey/src/other/git/.git --work-tree=/home/joey/src/other/git update-index --index-info fatal: Unable to create '/.git/index.lock': No such file or directory joey@darkstar:/> echo "$input" | GIT_WORK_TREE=/home/joey/src/other/git GIT_DIR=/home/joey/src/other/git/.git GIT_INDEX_FILE=.git/newindex git update-index --index-info fatal: Unable to create '/.git/newindex.lock': No such file or directory Work tree detached via git configuration: joey@darkstar:~/src/other/git> git config core.worktree /home/joey/src/other/git/tmptree joey@darkstar:~/src/other/git> mkdir tmptree joey@darkstar:~/src/other/git> cd tmptree/ joey@darkstar:~/src/other/git/tmptree> mkdir Documentation joey@darkstar:~/src/other/git/tmptree> cd Documentation/ joey@darkstar:~/src/other/git/tmptree/Documentation> echo "$input" | GIT_INDEX_FILE=.git/index git update-index --index-info fatal: Unable to create '/home/joey/src/other/git/tmptree/.git/index.lock': No such file or directory This seems to make it basically impossible for any program that wants to use GIT_INDEX_FILE to use anything other than an absolute path; there are too many configurations to keep straight that could change how git interprets what should be a simple relative path to a file. -- see shy jo
signature.asc
Description: PGP signature