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

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

From
Shawn O. Pearce <spearce@spearce.org>
Date
May 20, 2007, 03:54 UTC
Message-ID
<20070520035407.GF3141@spearce.org>
In-Reply-To
<200705192208.11905.jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> wrote:
Show 5 quoted lines
> Rationale: for non-blob entries size of an object has no much
> meaning, and is not very interesting.  Moreover, in planned
> pack v4 tree objects would be constructed on demand, so tree
> size would need to be calculated... although isn't object size
> stored in the header?

Yes and no. In pack v4 the object sizes stored within the packfile are more about what we need to know in order to efficiently unpack the object than about supplying the canonical format length. If a value is redundant, we don't store it. The canonical format length is almost always redundant.

For blobs we still need the raw data length to unpack efficiently, and hence we have the blob's canonical size readily available. For trees its actually more the tree entry record count, as that is all we need to know in order to recover the tree. For commits we don't even need a length, but we instead have the number of parent commits.

Since pack v4 is really about faster runtime decoding our ability
to reproduce canonical encoding of objects is reduced slightly.
I think that's OK as we actually only need the canonical encoding
infrequently (index-pack during network transfer, cat-file) and
we're not really considering pack v4 for network transfer.  Yet.
 
> I hope this addresses concerns mentioned in this thread: the
> alternate name --size for -l/--long option, and showing size
> for tree (and commit/submodule) objects.
Yes, thanks!
-- 
Shawn.
Previous: Jakub NarebskiNext: Shawn O. Pearce
Message 8 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.