builtin-rm: fix index lock file path
authorOlivier Marin <dkr@freesurf.fr>
Sat, 19 Jul 2008 16:24:46 +0000 (18:24 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sat, 19 Jul 2008 17:41:17 +0000 (10:41 -0700)
commit4d2646727997c82c04a82ce38e56d76e7b5d268b
treeae5c784cdd0412d039b6981cfb6c89aa61753a3c
parentfcf74dbfca9738a724995c92f0845e8018e51a0e
builtin-rm: fix index lock file path

When hold_locked_index() is called with a relative git_dir and you are
outside the work tree, the lock file become relative to the current
directory. So when later setup_work_tree() change the current directory
it breaks lock file path and commit_locked_index() fails.

This patch move index locking code after setup_work_tree() call to make
lock file relative to the working tree as it should be and add a test
case.

Noticed by Nick Andrew.

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-rm.c
t/t3600-rm.sh