[RFC] undo and redo

From: Carl Baldwin <cnb@fc.hp.com>
Date: 2005-08-25 03:23:39
Hello,

So, one thing that I liked about GNU Arch when I tried it out was the
ability to undo and redo changes in the local working copy.  I decided
to try to do this with git.  What I have is preliminary.  I'm sure it
could use some work.

So, I started with the assumption that all changes in the working copy
have been updated to the cache.  My scripts check this (with
git-diff-files) and abort if this is not the case.

Undo calls git-write-tree to write the changes to the object store.  It
stores that tree's hash and the current HEAD's tree's hash in a file.
Then it reverts the working copy to HEAD.

Redo grabs these two trees from the file, does git-write-tree to produce
a third tree and merges the three using the old HEAD's tree as the base
of the merge.  This way, new commits can happen and the local copy can
be modified since the undo and it should still work assuming no
conflicts emerge.

Attached are the two scripts.  Comments and criticism are welcome.

Cheers,
Carl

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Carl Baldwin                        Systems VLSI Laboratory
 Hewlett Packard Company
 MS 88                               work: 970 898-1523
 3404 E. Harmony Rd.                 work: Carl.N.Baldwin@hp.com
 Fort Collins, CO 80525              home: Carl@ecBaldwin.net
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-
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

Received on Thu Aug 25 03:24:22 2005

This archive was generated by hypermail 2.1.8 : 2005-08-25 03:24:25 EST