Don't both change directory and set GIT_WORK_TREE
authorKarl Hasselström <kha@treskal.com>
Mon, 14 Apr 2008 23:18:53 +0000 (01:18 +0200)
committerKarl Hasselström <kha@treskal.com>
Tue, 15 Apr 2008 20:00:29 +0000 (22:00 +0200)
commitf83d4b2ae9379d8c443036fcb56451f9396f63f4
treeef3de98a721017e5c97b52156974697b0b429004
parent1eae3bf5ef8561508d83845f27b61c7533ba3378
Don't both change directory and set GIT_WORK_TREE

We used to both change the working directory and set GIT_WORK_TREE
when calling git merge-recursive. This works with older versions of
git (up to and including 1.5.4.x, or thereabouts) because
merge-recursive ignores GIT_WORK_TREE. It stopped doing that sometime
just before 1.5.5, which broke StGit. (Given both GIT_WORK_TREE=".."
and cwd "..", it assumed the work tree was at "../..", instead of just
".." like we intended. This made t2800 fail.)

Just dropping the cd would solve the problem for new gits, but would
break StGit with older gits. But it works in both cases if we keep the
cd, and unconditionally set GIT_WORK_TREE=".". So this patch does
precisely that.

(git read-tree -u -m is also called from IndexAndWorktree, and it
 seems to always ignore GIT_WORK_TREE just like merge-recursive used
 to do. The patch fixes all calls made from IndexAndWorktree, so we're
 good if read-tree starts heeding GIT_WORK_TREE in the future.)

Signed-off-by: Karl Hasselström <kha@treskal.com>
stgit/lib/git.py