From: "Shawn O. Pearce" <spearce@spearce.org>
To: Nicolas Pitre <nico@cam.org>
Cc: Junio C Hamano <gitster@pobox.com>,
Wincent Colaiuta <win@wincent.com>, Jeff King <peff@peff.net>,
Joshua Jensen <jjensen@workspacewhiz.com>,
git@vger.kernel.org
Subject: Re: Reverting an uncommitted revert
Date: Wed, 20 May 2009 11:57:40 -0700 [thread overview]
Message-ID: <20090520185740.GP30527@spearce.org> (raw)
In-Reply-To: <alpine.LFD.2.00.0905201406280.3906@xanadu.home>
Nicolas Pitre <nico@cam.org> wrote:
> On Wed, 20 May 2009, Junio C Hamano wrote:
> > "Shawn O. Pearce" <spearce@spearce.org> writes:
> >
> > > You did say "uncommitted entry causes reflog append", so in Peff's
> > > original example of "git add a; vi a; git add a", we should be
> > > creating a reflog entry for that first added state, which is clearly
> > > not a disagreement.
> > >
> > > FWIW, I think this is a great idea, but lack the time to code it
> > > myself, otherwise I probably would start hacking on it right now.
> >
> > The devil's in the details. There are at least four things you would need
> > to design before start hacking.
> >
> > (0) Do you want this to apply only to Porcelains, or do you want to use
> > this for plumbing operations as well?
>
> Depends if current plumbing already takes care of reflogs for normal
> operations.
git update-ref and git symbolic-ref, both plumbing, update the
reflog automatically.
Why? Because that was the best way to ensure we always caught the
change, so we didn't miss updates and have a missing but important
state.
However, git rebase was moved from operating on its branch to work
on detached HEAD to avoid polluting the branch reflog with all of
the intermediate states. So, here is a case where porcelain had to
be changed after the fact to work around the log-by-default nature
of the plumbing.
> > (2) Enumerate the operations that falls into the category you decided in
> > the above question. For example, "git apply --index" and "git apply
> > --cached" would fall into the same category as "git add". If you
> > cover plumbing, you would also need to cover "git update-index".
>
> Plumbing should probably have the mechanism to create those trash
> reflogs if desired, but not active by default. Plumbing is normally for
> scripts, and once a script is debugged it shouldn't discard data by
> mistake. Let's not forget that this is a feature for mistake inducing
> humans.
git gui calls plumbing. It uses git update-index directly. IMHO,
git gui is porcelain, and wants this log, if its available. But,
by the same token, git filter-branch is porcelain, and probably
does *not* want this logging on the index updates it makes.
So, if its off by default, we really need a way to allow git gui
to force it on.
But... given that it is a safety measure, I would prefer to make it
on by default, and permit scripts to disable it, and update tools
like git filter-branch to disable it, because that fits with our
other rules to try and err on the side of caution for the user's
data when given the choice between raw speed and some minor safety.
(E.g. we fsync objects to disk for safety, not because its fast.)
> > (3) What should happen when you cannot write the index out as a tree? I
> > think it is easier to make mistakes during a conflicted merge
> > resolution than during a straight linear development of your own, and
> > one of the cases that would benefit most would be that you have
> > resolved a path to your satisfaction but then later you screw up
> > while resolving some other paths, losing an earlier resolution.
>
> This one is tricky. Maybe storing two reflog entries corresponding to
> the unresolved stages?
Yea, and as was pointed out, git stash doesn't support this, but
it probably should be able to do it, assuming the index could write
out 3 (or maybe 4) trees in this case, one for each stage.
--
Shawn.
next prev parent reply other threads:[~2009-05-20 18:57 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-20 2:34 Reverting an uncommitted revert Joshua Jensen
2009-05-20 3:10 ` Nicolas Pitre
2009-05-20 3:21 ` Jeff King
2009-05-20 3:35 ` Nicolas Pitre
2009-05-20 3:38 ` Jeff King
2009-05-20 4:58 ` Ping Yin
2009-05-20 9:15 ` Wincent Colaiuta
2009-05-20 10:16 ` Jakub Narebski
2009-05-20 12:53 ` Nicolas Pitre
2009-05-20 14:17 ` Shawn O. Pearce
2009-05-20 16:55 ` Eric Raible
2009-05-20 17:59 ` Junio C Hamano
2009-05-20 18:19 ` Nicolas Pitre
2009-05-20 18:25 ` Nicolas Pitre
2009-05-20 18:57 ` Shawn O. Pearce [this message]
2009-05-21 6:16 ` Junio C Hamano
2009-05-20 18:21 ` Jakub Narebski
2009-05-20 15:23 ` Wincent Colaiuta
2009-05-20 15:47 ` Nicolas Pitre
2009-05-20 16:13 ` Sverre Rabbelier
2009-05-20 16:58 ` Jeff King
2009-05-20 18:04 ` Nicolas Pitre
2009-05-20 18:08 ` Sverre Rabbelier
2009-05-21 3:47 ` Jeff King
2009-05-20 17:50 ` Junio C Hamano
2009-05-20 18:27 ` [PATCH] write-tree --ignore-cache-tree Junio C Hamano
2009-05-21 0:40 ` [PATCH 1/2] cache-tree.c::cache_tree_find(): simplify inernal API Junio C Hamano
2009-05-21 0:44 ` [PATCH 2/2] Optimize "diff-index --cached" using cache-tree 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=20090520185740.GP30527@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jjensen@workspacewhiz.com \
--cc=nico@cam.org \
--cc=peff@peff.net \
--cc=win@wincent.com \
/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).