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

Re: [1/4] Report info from trees

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Apr 19, 2005, 05:31 UTC
Message-ID
<Pine.LNX.4.21.0504190123180.30848-100000@iabervon.org>
In-Reply-To
<7vsm1nqr6x.fsf@assigned-by-dhcp.cox.net>
On Mon, 18 Apr 2005, Junio C Hamano wrote:
> ... what about names?  When somebody other than connectivity
> checker walks a tree, it would be more likely than not that 
> it wants to know what each entry is called, wound't it?
Yes; just add the name to the tree_entry_list.
> I can get the type of the object, either tree or blob, from
> tree->object.type, so I do not think the single-bit are needed.

You still need the mode bit (executable or not); also, the current code can't create an object without being told in advance what it is, so you need to use the directory bit.

Show 11 quoted lines
> Instead, how about something simpler like this?
> 
>     struct tree {
>         struct object object; /* the tree node itself as an object */
>         unsigned child_nr;
>         unsigned child_alloc;
>         struct {
>             struct object *object;
>             char *name;
>         } **child;
>     };

I think the linked list is easier to deal with, and matches the other code better.

> The tree->child[n].object would point at the same object as one
> of the object_list elements in tree->object.refs chain (i.e. you
> do not need to read the same object twice). 

The object code handles causing lookup_* to return the same object every time, so this isn't an issue. Note that each struct object has to be embedded in a struct <type> of the appropriate type, which means that we can only create a struct object by either knowing what type it is supposed to be or actually reading the file to find out what it actually is.

	-Daniel
*This .sig left intentionally blank*
Previous: Junio C HamanoNext: Daniel Barkalow
Message 4 of 12 in “More patches”
  1. Daniel BarkalowApr 19, 2005
  2. 1/4 Report info from treesDaniel Barkalow, Apr 19, 2005
  3. Junio C HamanoApr 19, 2005
  4. Daniel BarkalowApr 19, 2005
  5. 2/4 Sorting commits by dateDaniel Barkalow, Apr 19, 2005
  6. Petr BaudisApr 19, 2005
  7. David A. WheelerApr 19, 2005
  8. Daniel BarkalowApr 19, 2005
  9. Petr BaudisApr 19, 2005
  10. Daniel BarkalowApr 19, 2005
  11. 3/4 Add http-pullDaniel Barkalow, Apr 19, 2005
  12. 4/4 Make merge-base use dates to find answerDaniel Barkalow, Apr 19, 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.