On Thu, Aug 25, 2005 at 01:19:05PM -0700, Junio C Hamano wrote:
> "Kirby C. Bohling" <[EMAIL PROTECTED]> writes:
> > I guess my final question is what does undo/redo have over saving
> > stuff away in a patch assuming that the patch captures all of the
> > SCM meta-data (the add/move/remove file type commands). If git
> > doesn't capture all the meta-data in a patch, it would seem better
> > to make it do that and get this as a side-affect.
> One thing that Carl's undo saves that is not easily available in
> the patch form is the "what is this patch based on" information.
> If you had it, you could do a three-way merge instead of patch
> You were at A (time flows from left to right) when somebody
> (maybe your bright idea) interrupted you. You take a snapshot
> of your tree state D as a pair <A, D>, and rewind the tree to
> original commit A's state:
> Then you do the work that interrupted you, maybe making commits
> B and then C:
> At this point, you would want to restart working on whatever you
> were doing, which is the difference between A->D applied on top
> of C.
> You could keep that information as a patch between A->D and
> apply it on top of C to get there, which is your approach if I
> am reading you correctly. Carl does a three-way merge between C
> and D using A as the pivot point.
Just out of curiosity, why isn't the SHA1 of 'A' part of the
diff or patch format? I mean it can't be that hard to add it as a
single line of data that git can parse to extract that piece of
information. Then a patch would enable you to do the 3-way merge
you describe. If added properly "regular" patch would just ignore
that line. The patch would then record that it is relative to 'A'.
Assuming git could be taught "git-merge-patch" and then take use
the patch that's saved during the "undo" step and has the anchor for
the patch to use as the pivot point (as described above). Life
should be good. There are probably corner cases I don't understand,
but it sure looks like if you have the pivot or anchor point for the
patch embedded in the patch, you have all the needed information to
pull this off.
I would think this would be generally useful outside of the
context of "undo/redo" also.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html