login
Header Space

 
 

Re: [PATCH] More permissive "git-rm --cached" behavior without -f.

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Matthieu Moy <Matthieu.Moy@...>
Cc: <git@...>, Johannes Schindelin <Johannes.Schindelin@...>
Date: Saturday, July 14, 2007 - 3:16 am

Junio C Hamano <gitster@pobox.com> writes:


Having said that, I think this comment is not quite right.

+		else if (!index_only) {
+			/* It's not dangerous to git-rm --cached a
+			 * file if the index matches the file or the
+			 * HEAD, since it means the deleted content is
+			 * still available somewhere.
+			 */

Personally I do not think "rm --cached" needs any such "safety",
even though I'll keep the check for now, primarily because
loosening the restriction later is always easier than adding new
restriction.  I really do not think this is about protecting the
user from "deleted content is not available anywhere else".

In this sequence:

	edit a-new-file
	git add a-new-file
        edit a-new-file
        git add a-new-file

we do not complain, even though we are *losing* the contents we
earlier staged.  If you replace the second "git add" with
"git-rm --cached", the sequence should work the same way.  In
either case, you are working towards your next commit, and most
likely are doing a partial commit (iow, your working tree does
not match any of the commit you create in the middle).  Earlier
you thought you would want one state of the file in the next
commit, but now you decided against putting that new file in the
first commit in the series.  You may make further updates to the
index and would make a commit, but after making the commit, your
working tree still has "a-new-file" and you can add the contents
from it for the later commit.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
git-rm isn't the inverse action of git-add, Christian Jaeger, (Mon Jul 2, 2:09 pm)
Re: git-rm isn't the inverse action of git-add, Yann Dirson, (Mon Jul 2, 3:42 pm)
Re: git-rm isn't the inverse action of git-add, Christian Jaeger, (Mon Jul 2, 4:23 pm)
Re: git-rm isn't the inverse action of git-add, Yann Dirson, (Mon Jul 2, 4:40 pm)
Re: git-rm isn't the inverse action of git-add, Christian Jaeger, (Mon Jul 2, 5:20 pm)
Re: git-rm isn't the inverse action of git-add, Jeff King, (Tue Jul 3, 12:12 am)
Re: git-rm isn't the inverse action of git-add, Junio C Hamano, (Tue Jul 3, 12:47 am)
Re: git-rm isn't the inverse action of git-add, Jeff King, (Tue Jul 3, 12:59 am)
Re: git-rm isn't the inverse action of git-add, Junio C Hamano, (Tue Jul 3, 1:09 am)
Re: git-rm isn't the inverse action of git-add, Jeff King, (Tue Jul 3, 1:12 am)
Re: git-rm isn't the inverse action of git-add, Junio C Hamano, (Tue Jul 3, 2:26 am)
Re: git-rm isn't the inverse action of git-add, Matthieu Moy, (Mon Jul 2, 4:54 pm)
Re: git-rm isn't the inverse action of git-add, Johannes Schindelin, (Mon Jul 2, 5:05 pm)
Re: git-rm isn't the inverse action of git-add, Matthieu Moy, (Tue Jul 3, 6:37 am)
Re: git-rm isn't the inverse action of git-add, Johannes Schindelin, (Tue Jul 3, 8:09 am)
Re: git-rm isn't the inverse action of git-add, Matthieu Moy, (Tue Jul 3, 9:40 am)
Re: git-rm isn't the inverse action of git-add, Jan Hudec, (Wed Jul 4, 4:08 pm)
Re: git-rm isn't the inverse action of git-add, Matthieu Moy, (Thu Jul 5, 9:44 am)
Re: [RFC][PATCH] Re: git-rm isn't the inverse action of git-..., Johannes Schindelin, (Sun Jul 8, 2:10 pm)
Re: [RFC][PATCH] Re: git-rm isn't the inverse action of git-..., Johannes Schindelin, (Sun Jul 8, 5:49 pm)
Re: [PATCH] More permissive "git-rm --cached" behavior witho..., Junio C Hamano, (Sat Jul 14, 3:16 am)
Re: git-rm isn't the inverse action of git-add, Johannes Schindelin, (Tue Jul 3, 10:21 am)
speck-geostationary