git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: new stacked git feature

From
CMCatalin Marinas <catalin.marinas@gmail.com>
Date
Feb 13, 2008, 22:29 UTC
Message-ID
<b0943d9e0802131429p76f0981cm6e54a6a07042f229@mail.gmail.com>
In-Reply-To
<20080213000806.GB25839@diana.vm.bytemark.co.uk>
On 13/02/2008, Karl Hasselström <kha@treskal.com> wrote:
Show 17 quoted lines
> On 2008-02-12 16:42:46 +0000, Catalin Marinas wrote:
> > The background of this discussion is to have two or more StGIT
> > repositories and keep them in sync. An idea is to share the exported
> > patches directory and automatically synchronise them between various
> > repositories (we already have a 'stg sync' command which I use for
> > this kind of things but it's not automated).
> >
> > Yet another idea is to add some metadata to each commit log,
> > something like a unique id so that one can recreate the stack with
> > only a GIT revision id, without knowing the base.
>
> I've been trying to come up with a good way to represent undo
> information, and my current plan is this:
>
>   * Every time the patch stack is modified (that is, any time an StGit
>     command modifies anything at all), a new commit is made to a log
>     branch. Each StGit branch has one such log branch.

We already have another commit for the patch history. If we add this, we end up with 3 commit for each patch command. People already complained that StGIT is slow, I wouldn't go this route. I even think we should drop the patch history log and maybe use some git features like reflog.

For undo, can we not keep the HEAD of the old stacks in a simple text file? Or maybe use reflogs and only allow as many undos as information available in reflog.

Show 10 quoted lines
> I wasn't planning to try to build patch stack merging until later, but
> here's how I imagine it would work:
>
>   1. All patches are popped, and set to a special "conflicting" state
>      with three or more "a" trees: a.ours, a.theirs, a.base0, a.base1,
>      a.base2, .... Similarly for the "b" tree and the commit details.
>      (Of course, trivial conflicts could be sorted out automatically
>      at this point.)
>
>   2. The merged stack base is created with a normal recursive merge.

A recursive merge with the HEAD of another stack containing similar patches? If yes, when pushing it is likely that the patches already in the base will be emptied during a three-way merge.

Show 10 quoted lines
>   3. When a conflicting patch is pushed, we do the following:
>
>        1. For each of .ours, .theirs, .base0, ..., create a new "b"
>           tree just like we do when we normally push a patch. If there
>           are conflicts, autoresolve them like merge-recursive does
>           internally.
>
>        2. Create the single new "b" tree by making a recursive merge
>           of all these updated "b" trees. Represent any conflicts like
>           we usually do when pushing patches.

My idea is to merge each patch with the corresponding commit in the other branch and leave the base unchanged (like "stg sync"). The difficulty is in identifying which commit from the other branch has to be used. We could try guessing by the number of changes or just using the subject line, assuming that it won't change (or an extra id field in the commit text).

I find this workflow pretty difficult to implement since the StGIT patches are pretty volatile. It might be better to use topic branches instead.

-- 
Catalin
Previous: Karl HasselströmNext: Karl Hasselström
Message 3 of 8 in “Re: new stacked git feature”
  1. Catalin MarinasFeb 12, 2008
  2. Karl HasselströmFeb 13, 2008
  3. Catalin MarinasFeb 13, 2008
  4. Karl HasselströmFeb 13, 2008
  5. Catalin MarinasFeb 20, 2008
  6. Karl HasselströmFeb 21, 2008
  7. Catalin MarinasFeb 22, 2008
  8. Karl HasselströmFeb 22, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.