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

Re: Tracking branch history

From
Linus Torvalds <torvalds@osdl.org>
Date
May 13, 2006, 00:03 UTC
Message-ID
<Pine.LNX.4.64.0605121656350.3866@g5.osdl.org>
In-Reply-To
<Pine.LNX.4.64.0605121640210.3866@g5.osdl.org>
On Fri, 12 May 2006, Linus Torvalds wrote:
Show 8 quoted lines
> 
> IOW, a good (?) way to do it is to literally have a commit hook that 
> basically just does
> 
> 	echo $new >> .git/$branch-commit-history
> 
> possibly together with a datestamp thing (ie it could be something like
> "echo $new "$USER" $(date)" rather than just the commit SHA1).
Btw, the real problem with this is how to use it.

The only really valid use I see is to use it for date-based things, ie if given a date, look up the most recent commit ID that is older than the date in question. No other op seems to really make sense, but that one does.

Now, the one other operation that is semantically sensible is to use the list of commits to figure out a "path" through the commit space. However, that path won't actually even be well-defined (a fast-forward pull/merge can and often /will/ update the history in a way where it's impossible to select one particular path to the previous commit listed in the commit log).

The other thing that makes the "path" thing hard is that it's just fundamentally a pretty hard thing to calculate, even when it would result in one unambiguous path. I _believe_ that it comes close to what "git bisect" does, and that the bisect algorithm could probably be used to always create _a_ path between each commit (is just pick successive half-way-points - the commit list _should_ always have a direct dominance relationship, but the bisection algorithm should do something half-way sane even if you "jump about" by "git reset" or something).

It might be interesting to see if it's somethign that can be done reasonably efficiently.

			Linus
Previous: Linus TorvaldsNext: Daniel Barkalow
Message 3 of 21 in “Tracking branch history”
  1. Daniel BarkalowMay 12, 2006
  2. Linus TorvaldsMay 12, 2006
  3. Linus TorvaldsMay 13, 2006
  4. Daniel BarkalowMay 13, 2006
  5. Shawn PearceMay 13, 2006
  6. Linus TorvaldsMay 13, 2006
  7. Junio C HamanoMay 13, 2006
  8. Shawn PearceMay 13, 2006
  9. Shawn PearceMay 13, 2006
  10. Linus TorvaldsMay 13, 2006
  11. Junio C HamanoMay 13, 2006
  12. Shawn PearceMay 13, 2006
  13. Junio C HamanoMay 14, 2006
  14. Shawn PearceMay 15, 2006
  15. Shawn PearceMay 15, 2006
  16. Junio C HamanoMay 15, 2006
  17. Shawn PearceMay 15, 2006
  18. Shawn PearceMay 15, 2006
  19. Linus TorvaldsMay 13, 2006
  20. ElrondMay 13, 2006
  21. Junio C HamanoMay 14, 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.