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

Re: [RFC][StGit PATCH] Add support for merge-friendly branches

From
Karl Hasselström <kha@treskal.com>
Date
May 28, 2009, 12:48 UTC
Message-ID
<20090528124817.GA22262@diana.vm.bytemark.co.uk>
In-Reply-To
<20090528111212.21925.45527.stgit@pc1117.cambridge.arm.com>
On 2009-05-28 12:12:42 +0100, Catalin Marinas wrote:
> The patch proposes a new StGit command called "publish". This
> command allows one to develop patches normally on a StGit branch but
> publish the stack changes to a separate, merge-friendly branch whose
> history is not re-writable.

Hmm, interesting. I don't think I'd want to use a command like this myself, but I can see how it might be useful.

Show 14 quoted lines
> +    # check for same tree (already up to date)
> +    if public_tree.sha1 == stack.head.data.tree.sha1:
> +        out.info('"%s" already up to date' % public_ref)
> +        return
> +
> +    # check for rebased stack. In this case we emulate a merge with the stack
> +    # base by setting two parents.
> +    merge_base = repository.get_merge_base(public_head, stack.base)
> +    if merge_base.sha1 != stack.base.sha1:
> +        public_head = __create_commit(repository, stack.head.data.tree,
> +                                      [public_head, stack.base], options)
> +        repository.refs.set(public_ref, public_head, 'publish')
> +        out.info('Merged the stack base into "%s"' % public_ref)
> +        return

Hmm. Couldn't the merge base conceivably be higher up in the stack? Like, right at the beginning, don't we have public_head == stack.head? That would be caught by the "same tree" check" a bit earlier, but after adding another patch, don't we have public_head == stack.head^ ? Which would give merge_base == public_head.

Show 5 quoted lines
> +    def get_merge_base(self, commit1, commit2):
> +        """Return the merge base of two commits."""
> +        sha1 = self.run(['git', 'merge-base',
> +                         commit1.sha1, commit2.sha1]).output_one_line()
> +        return self.get_commit(sha1)

This funcion should probably return a list of zero or more merge bases. See the --all flag to git merge-base.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle
Previous: Catalin MarinasNext: Catalin Marinas
Message 2 of 12 in “Add support for merge-friendly branches”
  1. Catalin MarinasMay 28, 2009
  2. Karl HasselströmMay 28, 2009
  3. Catalin MarinasMay 28, 2009
  4. Catalin MarinasMay 28, 2009
  5. Karl HasselströmMay 29, 2009
  6. Catalin MarinasMay 29, 2009
  7. Karl HasselströmMay 29, 2009
  8. Catalin MarinasMay 29, 2009
  9. Karl HasselströmMay 29, 2009
  10. Catalin MarinasMay 29, 2009
  11. Karl HasselströmMay 29, 2009
  12. Fwd: [RFC][StGit PATCH] Add support for merge-friendly branchesmartin f krafft, May 28, 2009

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.