From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Christian Jaeger <christian@jaeger.mine.nu>,
Yann Dirson <ydirson@altern.org>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
git@vger.kernel.org
Subject: Re: git-rm isn't the inverse action of git-add
Date: Tue, 3 Jul 2007 00:59:48 -0400 [thread overview]
Message-ID: <20070703045948.GE4007@coredump.intra.peff.net> (raw)
In-Reply-To: <7vhcomt7oa.fsf@assigned-by-dhcp.cox.net>
On Mon, Jul 02, 2007 at 09:47:33PM -0700, Junio C Hamano wrote:
> These were explicitly done per request from git-rm users (myself
> not one of them) who wanted to:
>
> rm the-file
> git rm the-file
Ah, makes sense (if such a thing can be said about CVS behavior).
> > H I W | ok? | why?
> > ---------------------------------------------------
> > N A N | ? | currently ok, but 'A' recoverable only through fsck
> > N A A | ? | currently not ok, but 'A' still available in W
> > A A B | ? | currently not ok, but 'A' still available in H
> > A B N | ? | currently ok, but 'B' recoverable only through fsck
> > A B B | ? | currently not ok, but 'B' still available in W
>
> I personally do not think we would need any safety check for
> "git rm --cached", as it does not touch the working tree. If
It depends on how we want to define "lost" data. In many cases, we are
protecting against losing content that will still be available until the
next git-prune. Should our safety valve protect against that case, or
should it not? We are totally inconsistent.
The main one for --cached, of course, is when that content exists _only_
in the index, but no longer in the working tree (!A A N or !A A B). You
really should be using regular git-rm (in the first case, since you are
saying "I don't want this file anymore") or git-add (throw out the old
data, use my new version).
OTOH, clearly git-add can "lose" data in this way as well, since a
"modify, git-add, modify, git-add" will "lose" any reference to the
index state after the first add. So maybe that is not worth worrying
about at all (in which case our safety valve is too strict in many
places).
We could also issue a warning when "losing" reference to data that is in
the object db, which would include the sha1; in that case, an immediate
"oops" could be rectified with git-show.
> one cares about the differences among three states, one would
> not issue "rm --cached" anyway. The only reason "rm --cached"
> is used is because one _knows_ that any blob should not exist at
> that path in the index.
How about:
git-add foo
echo changes >>foo
# oops, I don't want to commit foo just yet
git-rm --cached foo
but in that case, maybe the user doesn't actually _care_ about that
intermediate state of 'foo'.
-Peff
next prev parent reply other threads:[~2007-07-03 4:59 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-02 18:09 git-rm isn't the inverse action of git-add Christian Jaeger
2007-07-02 19:42 ` Yann Dirson
2007-07-02 20:23 ` Christian Jaeger
2007-07-02 20:40 ` Yann Dirson
2007-07-02 20:54 ` Matthieu Moy
2007-07-02 21:05 ` Johannes Schindelin
2007-07-03 10:37 ` Matthieu Moy
2007-07-03 12:09 ` Johannes Schindelin
2007-07-03 13:40 ` Matthieu Moy
2007-07-03 14:21 ` Johannes Schindelin
2007-07-04 20:08 ` Jan Hudec
2007-07-05 13:44 ` Matthieu Moy
2007-07-05 14:00 ` David Kastrup
2007-07-08 17:36 ` [RFC][PATCH] " Matthieu Moy
2007-07-08 18:10 ` Johannes Schindelin
2007-07-08 20:34 ` Matthieu Moy
2007-07-08 21:49 ` Johannes Schindelin
2007-07-09 9:45 ` Matthieu Moy
2007-07-13 17:36 ` Matthieu Moy
2007-07-13 17:41 ` [PATCH] More permissive "git-rm --cached" behavior without -f Matthieu Moy
2007-07-13 17:57 ` Jeff King
2007-07-13 18:53 ` Matthieu Moy
2007-07-14 3:42 ` Jeff King
2007-07-14 0:44 ` Jakub Narebski
2007-07-14 6:52 ` Junio C Hamano
2007-07-14 7:16 ` Junio C Hamano
2007-07-14 10:14 ` Matthieu Moy
2007-07-02 21:20 ` git-rm isn't the inverse action of git-add Christian Jaeger
2007-07-03 4:12 ` Jeff King
2007-07-03 4:47 ` Junio C Hamano
2007-07-03 4:59 ` Jeff King [this message]
2007-07-03 5:09 ` Junio C Hamano
2007-07-03 5:12 ` Jeff King
2007-07-03 6:26 ` Junio C Hamano
2007-07-11 12:20 ` Jakub Narebski
2007-07-11 18:56 ` Jan Hudec
2007-07-11 21:26 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070703045948.GE4007@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=Johannes.Schindelin@gmx.de \
--cc=christian@jaeger.mine.nu \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ydirson@altern.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).