Out-of-repository file remove error
- From
Nick Andrew <nick@nick-andrew.net>
- Date
- Jul 19, 2008, 08:23 UTC
- Message-ID
- <20080719082314.GA15419@mail.local.tull.net>
git rm seems to have a problem with removing a file from a repository when the repository .git and working tree are not in the current directory. It leaves an index.lock file.
Here's a script to show the bug:
mkdir Bugtest cd Bugtest git init date > newfile git add newfile git commit -m 'Added' newfile cd .. git --git-dir=Bugtest/.git --work-tree=Bugtest rm newfile ls -l Bugtest/.git/index.lock
Output:
Initialized empty Git repository in .../Bugtest/.git/ Created initial commit 43dec15: Added 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 newfile rm 'newfile' fatal: Unable to write new index file -rw-r--r-- 1 nick nick 32 Jul 19 18:20 Bugtest/.git/index.lock
I tested on:
git version 1.5.6.2 git version 1.5.6.3.440.g9d8f
Nick.