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

Re: rev-list/tree committer/author information.

From
Daniel Barkalow <barkalow@iabervon.org>
Date
May 16, 2005, 22:35 UTC
Message-ID
<Pine.LNX.4.21.0505161747290.30848-100000@iabervon.org>
In-Reply-To
<7vekc6onzc.fsf_-_@assigned-by-dhcp.cox.net>
On Mon, 16 May 2005, Junio C Hamano wrote:
Show 11 quoted lines
> The only reason why I did it that way was because the strategy
> taken by "struct object" derivatives seemed to pick up bare
> absolute minimum to support actual callers that have immediate
> need for information stored in structural fields, as opposed to
> designing for helping yet to be written callers by adding fields
> to hold information of "having this might also help somebody in
> the future" type.  And the author and committer names are in the
> structured fields while signed-off-by and others are not.  Also
> when author / committer name strings are intern'ed like the way
> I did, the memory consumption even for a long sequence of
> commits are kept reasonably low.  However,...

I think if we had a good reason to make author and committer structured, there must be some reason we'll want them parsed out eventually, although we may not have reached the point at which it makes sense to do it.

Show 8 quoted lines
> The above implies to keep the unpacked raw data as a whole to be
> accessible to the callers for at least commit objects and if we
> go that route I think it would make more sense to do that
> uniformly for everything (probably except for pure "blob"
> objects for size concerns but we might as well do them while we
> are at it).  On the other hand, the current lifetime rules being
> what it is, that strategy may introduce memory consumption
> problems when working on a huge project.

Perhaps have a struct object field for the unpacked data, have it filled by a unpack_object(struct object *) function, have the parse functions use it if it's filled, and have a function to free it (and NULL the field).

So, if you want the actual contents, you'd call unpack_object(&commit->obj) before parse_commit(commit), and close_object(&commit_obj) when you're done, and the parse wouldn't duplicate the work. The lifetime rules only really care that the return value from lookup_*() stays the same for the duration of the program, not that the fields in it don't get cleared (aside from the flags and the hash).

This could be useful even for blobs; I'm working on a program to do diff/merge on commits and everything under them (taking advantage of all available information if the fast path leads to a conflict); it would be nice not to have to go through the filesystem with the blob data.

	-Daniel
*This .sig left intentionally blank*
Previous: Petr BaudisNext: Junio C Hamano
Message 5 of 28 in “Summary of core GIT while you are away.”
  1. Junio C HamanoMay 14, 2005
  2. Linus TorvaldsMay 16, 2005
  3. rev-list/tree committer/author information.Junio C Hamano, May 16, 2005
  4. Petr BaudisMay 16, 2005
  5. Daniel BarkalowMay 16, 2005
  6. Junio C HamanoMay 16, 2005
  7. Petr BaudisMay 16, 2005
  8. Kay SieversMay 26, 2005
  9. Junio C HamanoMay 26, 2005
  10. Linus TorvaldsMay 26, 2005
  11. Linus TorvaldsMay 26, 2005
  12. Kay SieversMay 26, 2005
  13. Junio C HamanoMay 26, 2005
  14. Kay SieversMay 26, 2005
  15. Junio C HamanoMay 26, 2005
  16. H. Peter AnvinMay 27, 2005
  17. Junio C HamanoMay 27, 2005
  18. H. Peter AnvinMay 27, 2005
  19. Junio C HamanoMay 27, 2005
  20. H. Peter AnvinMay 27, 2005
  21. Junio C HamanoMay 27, 2005
  22. Linus TorvaldsMay 27, 2005
  23. H. Peter AnvinMay 26, 2005
  24. Junio C HamanoMay 26, 2005
  25. Kay SieversMay 26, 2005
  26. Junio C HamanoMay 27, 2005
  27. Kay SieversMay 27, 2005
  28. Junio C HamanoMay 27, 2005

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.