Re: How to commit removed file?
- From
- Juergen Ruehle <j.ruehle@bmiag.de>
- Date
- Jan 2, 2007, 21:49 UTC
- Message-ID
- <17818.54115.482000.804065@lapjr.intranet.kiel.bmiag.de>
- In-Reply-To
- <Pine.LNX.4.63.0701022211100.22628@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin writes: > On Tue, 2 Jan 2007, Michael S. Tsirkin wrote: > > > > I'd like to remove a file and commit the removal while > > > leaving out other changes in repository/index. > > > > > > $git rm kernel_patches/fixes/ib_verbs_warning_fix.patch > > > rm 'kernel_patches/fixes/ib_verbs_warning_fix.patch' > > > > > > $ git commit kernel_patches/fixes/ib_verbs_warning_fix.patch > > > error: pathspec 'kernel_patches/fixes/ib_verbs_warning_fix.patch' did not match > > > any file(s) known to git. > > > Did you forget to 'git add'? > > > > > > A similiar thing works with "git add". > > > > Any ideas? Can this be done with git? > > Did you actually try the "--" thing I suggested in > http://article.gmane.org/gmane.comp.version-control.git/35699/? > > Besides, I just tested with current "next": > > $ git commit kernel_patches/fixes/ib_verbs_warning_fix.patch > Created commit 89a5bb5ac16fb8be9b6e061284e191cafb3e4da2 > 1 files changed, 0 insertions(+), 22 deletions(-) > delete mode 100644 a234
But (at least in next from yesterday or something -- having an old modem here only:-) it doesn't work if you delete the file using git-rm, because git-commit -o operates only on known files: one of the first things in this code path is a
git-ls-files --error-unmatch -- $@
This seems wrong because -o is supposed to bypass the index. It should probably be doing ls-tree --name-only HEAD -- $@ instead, but ls-tree doesn't have the --error-match functionality.