Subject: Re: Reverting an uncommitted revert

From: Jakub Narebski <[email-masked]>
Date: Wed, 20 May 2009 11:21:19 -0700 (PDT)

Junio C Hamano <[email-masked]> writes:
> "Shawn O. Pearce" <[email-masked]> 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?
> 
>  (1) When would you "auto" write-tree?  When you do "git add" or anything
>      that adds new contents to the index?  Or immediately before you do
>      something destructive like "git reset"?  Or perhaps both?
> 
>  (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".

I guess that if we will not be able to resolve performance issues,
then such safety net would be of necessity limited only to highly
destructive commands that are more likely to destroy huge amount of
work if handled not carefully.

> 
>  (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.

Hmmm... because of (3), and because of performance concerns,
especially for the deep hierarchy, perhaps it would be better to use
here backup copy of index, or to save disk space just a delta to index.
On the other hand this would introduce yet another mechanism...

BTW., ad (3): how stash deals with conflicted merge? Hmmm... it doesn't

 $ git stash
 foo: needs merge
 foo: needs merge
 foo: unmerged (257cc5642cb1a054f08cc83f2d943e56fd3ebe99)
 foo: unmerged (b7d6715e2df11b9c32b2341423273c6b3ad9ae8a)
 foo: unmerged (5716ca5987cbf97d6bb54920bea6adde242d87e6)
 fatal: git-write-tree: error building trees
 Cannot save the current index state

-- 
Jakub Narebski
Poland
ShadeHawk on #git