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

Re: [topgit] tg update error

From
MKmartin f krafft <madduck@debian.org>
Date
Feb 12, 2009, 21:41 UTC
Message-ID
<20090212214106.GC26573@piper.oerlikon.madduck.net>
In-Reply-To
<7veiy3l689.fsf@gitster.siamese.dyndns.org>
also sprach Junio C Hamano <gitster@pobox.com> [2009.02.12.2201 +0100]:
> It would be nice to hear TopGit people defend why setting HEAD to outside
> refs/heads/ is justified, why doing so should not break other things, and
> why it was needed.

As far as I understand it, TopGit does not /need/ to set HEAD to refs/top-bases/foo, but it currently does so as part of its algorithm:

When tg-update updates a depending branch, it first merges the dependent branch into the base of the topic branch, which is pointed to by the corresponding top-base (refs/top-bases/foo). It then merges the top-base into the topic branch, "foo" in this case.

The result is the same as if the base branch had been merged into "foo", and refs/top-bases/foo updated to point to the head of the base branch.

This stops working, however, as soon as you have a topic branch depending on more than one base branches. Since you need to track the base of a topic branch (e.g. in order to be able to get the diff represented by the TopGit branch), you now have a problem: which of the base branches is the base to diff against?

TopGit addresses this requirement by creating a "virtual" branch into which it merges all the bases (into the top-base) first, and then merging this "virtual" branch into the topic branch. The result is a merge commit combining all bases, which is a parent of the merge commit into the topic branch, and can thus serve as the origin of a diff calculation.

TopGit right now does all of this while HEAD is detached: it points into the refs/top-bases/* namespace -- the "virtual" branch. Here, it does the merges of the bases, and then checks out the topic branch to merge this combined ("virtual") base.

To work around the new restriction in Git, TopGit would need to make a proper branch, merge the bases into it, merge that branch into the topic branch, and the probably delete the branch pointer, as it's no longer needed and would only pollute the refs/heads/* namespace. It could certainly do this (with a minor performance impact), but it seems like jumping through hoops and around Git's restrictions, without any real benefit.

Point being: I understand the reason behind the restriction, and I wouldn't mind if it were default, but maybe there could be a controlled way to circumvent it for cases like the one described above, where it is safe to assume that the user^W^W the tool "knows" what it is doing.

-- 
 .''`.   martin f. krafft <madduck@d.o>      Related projects:
: :'  :  proud Debian developer               http://debiansystem.info
`. `'`   http://people.debian.org/~madduck    http://vcs-pkg.org
  `-  Debian - when you have better things to do than fixing systems
 
in the beginning was the word,
and the word was content-type: text/plain
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 20 in “[topgit] tg update error”
  1. Aneesh KumarFeb 12, 2009
  2. martin f krafftFeb 12, 2009
  3. Aneesh Kumar K.VFeb 12, 2009
  4. martin f krafftFeb 12, 2009
  5. Aneesh Kumar K.VFeb 12, 2009
  6. Bert WesargFeb 12, 2009
  7. Jeff KingFeb 12, 2009
  8. Jeff KingFeb 12, 2009
  9. martin f krafftFeb 12, 2009
  10. Junio C HamanoFeb 12, 2009
  11. martin f krafftFeb 12, 2009
  12. Junio C HamanoFeb 12, 2009
  13. martin f krafftFeb 13, 2009
  14. Junio C HamanoFeb 13, 2009
  15. Junio C HamanoFeb 13, 2009
  16. Jeff KingFeb 13, 2009
  17. Junio C HamanoFeb 14, 2009
  18. Jeff KingFeb 14, 2009
  19. Junio C HamanoFeb 14, 2009
  20. Jeff KingFeb 14, 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.