]> git.ipfire.org Git - thirdparty/git.git/commit - Makefile
Add builtin "git rm" command
authorLinus Torvalds <torvalds@osdl.org>
Fri, 19 May 2006 23:19:34 +0000 (16:19 -0700)
committerJunio C Hamano <junkio@cox.net>
Sat, 20 May 2006 00:28:33 +0000 (17:28 -0700)
commitd9b814cc97f16daac06566a5340121c446136d22
tree86607447958a0f032a4a26a37effbda03b4d6d8a
parent3c6a370b0ee78114a656acba04fddf306252b9d5
Add builtin "git rm" command

This changes semantics very subtly, because it adds a new atomicity
guarantee.

In particular, if you "git rm" several files, it will now do all or
nothing. The old shell-script really looped over the removed files one by
one, and would basically randomly fail in the middle if "-f" was used and
one of the files didn't exist in the working directory.

This C builtin one will not re-write the index after each remove, but
instead remove all files at once. However, that means that if "-f" is used
(to also force removal of the file from the working directory), and some
files have already been removed from the workspace, it won't stop in the
middle in some half-way state like the old one did.

So what happens is that if the _first_ file fails to be removed with "-f",
we abort the whole "git rm". But once we've started removing, we don't
leave anything half done. If some of the other files don't exist, we'll
just ignore errors of removal from the working tree.

This is only an issue with "-f", of course.

I think the new behaviour is strictly an improvement, but perhaps more
importantly, it is _different_. As a special case, the semantics are
identical for the single-file case (which is the only one our test-suite
seems to test).

The other question is what to do with leading directories. The old "git
rm" script didn't do anything, which is somewhat inconsistent. This one
will actually clean up directories that have become empty as a result of
removing the last file, but maybe we want to have a flag to decide the
behaviour?

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Makefile
builtin-rm.c [new file with mode: 0644]
builtin.h
git-rm.sh [deleted file]
git.c