Re: [StGit RFC] A more structured way of calling git

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Karl
Date: Friday, November 16, 2007 - 12:42 am

On 2007-11-15 18:28:16 +0000, Catalin Marinas wrote:


Thanks!


Yes, that seems like a good idea.


Yes. This is a very nice property that makes the whole enterprise
feasible.


Yes. Unit testing would be easier with the new code, since it's more
modular.


Probably. I've alredy made that spelling error myself at least once
when writing code.


Yes. This applies to a few other things as well -- I try to be careful
to write things so that they could be cached transparently if it turns
out we need it. But I also try to not optimize prematurely.

In some cases the caching is more than just a speed optimization.
Commits and trees can be compared with regular Python object identity,
for example, because I never create duplicates.


The sample code I posted does exactly this index trick. So yes, I
think it's a splendid idea. :-)

Basically, what it does (or eventually should do) is repeatedly use
the temp index to create the new commits without ever touching the
default index or the worktree. Only if a merge conflicts would we
check out one of the parents and spill the conflicts to the worktree.
(And once we're finished pushing we'd want to check out the new stack
top, obviously.)

The only problem is that while git-read-tree can do a three-way merge
in a temp index without touching the worktree, git-merge-recursive
assumes that the worktree reflects one of the trees to be merged and
can be written to. Which is _totally OK_ if there really is going to
be a conflict. But merge-recursive does fancier conflict resolution
than read-tree (I think -- I still have to look up exactly what, but I
don't think read-tree does rename detection for example), so it might
succeed even if read-tree failed.


Yes, this was exactly what I was refering to when I talked about
transaction logging. The only difference is that I'd prefer a simple
text format instead of a pickle, but we can have a fight about that
detail later. :-)

The complete state that would have to be saved would be

  * (patchname, commit sha1) pairs for all patches

  * (branchname, branch head sha1) pair

  * the ordered lists of applied, unapplied, and eventually also
    hidden patches

This is somewhat redundant (applied/unapplied could be inferred from
the commit DAG, etc.) but it would allow us to represent relevant
illegal states as well, which is needed in order to be able to undo
repairs of inconsistent stacks.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle
-
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
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [StGit RFC] A more structured way of calling git, Catalin Marinas, (Sat Nov 3, 3:56 am)
Re: [StGit RFC] A more structured way of calling git, Yann Dirson, (Sat Nov 3, 7:28 am)
Re: [StGit RFC] A more structured way of calling git, Catalin Marinas, (Thu Nov 15, 11:28 am)
Re: [StGit RFC] A more structured way of calling git, Karl , (Fri Nov 16, 12:42 am)