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

Re: [topgit] tg update error

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 13, 2009, 09:04 UTC
Message-ID
<7v63jebtdb.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<7vmycqeqqh.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 12 quoted lines
> If you *are* setting HEAD to some ref that is outside refs/heads (or even
> inside refs/heads for that matter), at that point the HEAD is *not*
> detached, so no, it obviously is *not* what is happening.
>
> I am asking why you need to use a ref to do that, *if* it is a tentative
> state while the program is running.  You are probably calling a git
> plumbing or Porcelain command that updates HEAD, and the reason why you
> point HEAD outside refs/heads/ is beause you would want the command you
> call to update one of the refs/top-bases/ ref through HEAD.  I am asking
> why you are not running these commands on a normal detached HEAD, and then
> use update-ref (not symbolic-ref) plumbing to update the refs/top-bases/
> ref you would want to update when it is done.

Ok, I did read the script (yuck). You do break out of TopGit process when a merge conflict prevents the update operation to complete and do give control back to the end user, so you can leave HEAD in a state that points at a non-branch, and you do use the fact that the HEAD is pointing at something funny as a sign that you are in the middle of conflicted merge resolution.

It is just like how vanilla git uses MERGE_HEAD as the marker to signal that it is in a funny state.

While I think it is a cute idea to use which funny hierarchy HEAD points at to indicate what funny/intermediate state your interrupted operation is in, and it may seem to be cleaner than using a marker file like MERGE_HEAD at first sight, I do not think it is a wise thing to do in the long run.

You can only express two pieces of information (the overall "category of state" by which funny ref/ hierarchy HEAD points at, and one object name by storing it in the ref pointed at by HEAD), and if you need more (such as MERGE_MSG that stores pre-packaged log message pieces is used during a merge, in addition to MERGE_HEAD), you would need to use more than just the "cute HEAD" trick to store them *anyway*. Which means that it is a bad tradeoff to use "cute HEAD" --- it closes the possibility to detect user error to point HEAD at an incorrect place and I do not see the benefit of "cute HEAD" outweigh the downside.

Previous: Junio C HamanoNext: Jeff King
Message 15 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.