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

Re: [PATCH] Add an option to git-ls-tree to display also the size of object

From
Shawn O. Pearce <spearce@spearce.org>
Date
May 15, 2007, 23:20 UTC
Message-ID
<20070515232017.GP3141@spearce.org>
In-Reply-To
<7vy7jpj4lr.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
Show 10 quoted lines
> Jakub Narebski <jnareb@gmail.com> writes:
> 
> > Add -l/--long/--size option to git-ls-tree command, which displays
> > object size of an entry after object id (left-justified with minimum
> > width of 7 characters).
> 
>   Also I suspect that having to show the size of a tree object,
>   expressed in terms of the canonical representation, might
>   force packv4 aware ls-tree to convert its traversal efficient
>   representation to the canonical one only to get its size.

Yes, you are right Junio. In pack v4 we don't know the size of the canonical representation. We compute it on the fly when its needed by summing up the lengths of the names of each element in the tree, so it requires us to expand the delta chain and is thus O(delta_depth * entry_count) or something like that.

I didn't see this as a huge problem, as the only in-tree caller at the time that needed the size and did not also want the canonical representation was the -s flag to cat-file.

So I'm kind of against adding something that would want to print that canonical representation for every subtree in a parent tree, as it would make either pack v4 less efficient for that operation or force it to store the canonical size, for no other good reason.

-- 
Shawn.
Previous: Shawn O. Pearce
Message 9 of 9 in “Add an option to git-ls-tree to display also the size of object”
  1. Add an option to git-ls-tree to display also the size of objectJakub Narebski, May 15, 2007
  2. Junio C HamanoMay 15, 2007
  3. Jakub NarebskiMay 15, 2007
  4. Junio C HamanoMay 16, 2007
  5. Jakub NarebskiMay 16, 2007
  6. Junio C HamanoMay 16, 2007
  7. Add an option to git-ls-tree to display also the size of blobJakub Narebski, May 19, 2007
  8. Shawn O. PearceMay 20, 2007
  9. Shawn O. PearceMay 15, 2007

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.