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

Re: Notes on Subproject Support

From
Junio C Hamano <junkio@cox.net>
Date
Jan 24, 2006, 01:50 UTC
Message-ID
<7vek2yxukm.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0601231116550.25300@iabervon.org>
Daniel Barkalow <barkalow@iabervon.org> writes:
Show 7 quoted lines
> I think it would be a lot more fragile if switching branches requires 
> multiple programs interacting with the index file. If things get 
> interrupted after the tree is read but before the bindings are changed, 
> the user will probably generate an inconsistant commit or have to deal 
> with figuring out what's going on. It is a nice property of the current 
> system that the index file never exists under the usual filename without 
> being consistant.

That is certainly an issue, which we have had already for quite some time, I am afraid. We can get interrupted during "switch branches" flow after read-tree -u -m but before updating HEAD. We can also get interrupted during "commit" flow after writing the commit object out before updating the ref pointed at by HEAD. No?

If we are truly serious about solving the issue of getting interrupted in the middle, I suspect we have to take the "index is a staging area for the next commit" approach I digressed into last night. It would involve introducing a git-atomic-checkout command to replace the current "git-rev-parse, git-read-tree, then git-symbolic-ref" sequence in the checkout flow. In the commit flow, we would need git-commit-index command to replace the current "git-write-tree, git-commit-tree, then git-update-ref" sequence.

I am not particularly opposed to that, but I suspect it might be a moderate amount of work for very little gain. Continuing with the digression, the updated index file may contain:

  1. list of <blob path, object name>
  2. list of parent commit object names for the next commit
  3. the name of the local branch to create the next commit on
  4. for each bound path:
     list of parent commit object names for that path.
1. is what we have in the current (version 2) index file.
2. contains:
 - 0 commit in an index file before the initial commit
 - 1 commit in an index file after a fresh checkout and records
   the commit object name we checked out (replaces HEAD+heads/$branch)
 - 2 commits in an index file after 3-way read-tree, or more
   during an Octopus merge (replaces HEAD+MERGE_HEAD)
3. may not be needed, but if we did so, it would replace HEAD.
4. is similar to 2 but for bound subprojects.  Usually we have
   one commit per bound path to record the "bind" line commit we
   read from the commit object after a fresh checkout.  During a
   subproject merge, we would:
   - start out with 1 commit read from the "bind" line;
   - merging in another subproject commit would add that commit;
   - when making a new subproject commit, the recorded commits
     are used as its parents.
Previous: Daniel BarkalowNext: Daniel Barkalow
Message 11 of 15 in “Notes on Subproject Support”
  1. Junio C HamanoJan 23, 2006
  2. Daniel BarkalowJan 23, 2006
  3. Junio C HamanoJan 23, 2006
  4. Junio C HamanoJan 23, 2006
  5. Alexander LitvinovJan 23, 2006
  6. Daniel BarkalowJan 23, 2006
  7. Junio C HamanoJan 23, 2006
  8. Daniel BarkalowJan 23, 2006
  9. Junio C HamanoJan 24, 2006
  10. Daniel BarkalowJan 23, 2006
  11. Junio C HamanoJan 24, 2006
  12. Daniel BarkalowJan 24, 2006
  13. Junio C HamanoJan 23, 2006
  14. Martin AtukundaJan 23, 2006
  15. Junio C HamanoJan 23, 2006

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.