Thread (3 messages) flat view 3 messages, 3 authors, 2016-06-15

Re: git-rm isn't the inverse action of git-add

From: Jan Hudec <hidden>
Date: 2016-06-15 22:43:19

On Tue, Jul 03, 2007 at 15:40:12 +0200, Matthieu Moy wrote:
Johannes Schindelin [off-list ref] writes:
quoted
Hmm. How did you expect then, that git-rm does _not_ lead to data
loss? 
Because there are tons of possible behaviors for "$VCS rm", and I'd
expect it to be safe even if VCS=git, since it is with all the other
VCS I know.

What's wrong with the behavior of "hg rm"?
What's wrong with the behavior of "svn rm"?
What's wrong with the behavior of "bzr rm"?
(no, I won't do it with CVS ;-) )

None of these commands have the problem that git-rm has.
Hm. They all behave roughly the same: They unversion the file and unlink it,
unless it is modified, in which case they unversion it and leave it alone.

Now git has the extra complexity that index contains also content of the
file. But the behaviour can be easily adapted like this (HEAD = version in
HEAD, index = version in index, tree = version in tree):
 - if (HEAD == index && index == version) unversion and unlink
 - else if (HEAD == index || index == version) unversion
 - else print message and do nothing

Would you consider that a sane behaviour?

-- 
						 Jan 'Bulb' Hudec [off-list ref]

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help