{"thread":{"id":"24738","subject":"[PATCH] ls-tree: show size of trees with -l","startedAt":"2010-08-13T20:20:23Z","lastAt":"2010-08-14T14:40:11Z","messageCount":2,"participants":["Nguyễn Thái Ngọc Duy","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"148077","messageId":"1281730823-10797-1-git-send-email-pclouds@gmail.com","threadId":"24738","inReplyTo":null,"subject":"[PATCH] ls-tree: show size of trees with -l","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-08-13T20:20:23Z","receivedAt":"2010-08-13T20:20:23Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"In commit a5bbda8 (Add an option to git-ls-tree to display also the\nsize of blob), Jakub said that size of non-blob entries had no\nmeaning therefore dashes were printed instead.\n\nI would say tree size, along with blob size, helps estimate bandwidth\nneeded to transfer a single commit, for example. Of course it's not\ncompletely accurate as all objects will be compressed. But it gives a\nrough figure to compare.\n\nPack v4 has not come yet (and it's been three years, I truely hope it\nwill come next year). When it comes, I will gladly send a revert patch\nof this one if it proves too expensive to compute tree size.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n By the way, dashes will still be printed for subprojects, I guess.\n\n Documentation/git-ls-tree.txt |    2 +-\n builtin/ls-tree.c             |    2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-ls-tree.txt b/Documentation/git-ls-tree.txt\nindex 1f89d36..9e02905 100644\n--- a/Documentation/git-ls-tree.txt\n+++ b/Documentation/git-ls-tree.txt\n@@ -50,7 +50,7 @@ OPTIONS\n \n -l::\n --long::\n-\tShow object size of blob (file) entries.\n+\tShow object size of entries.\n \n -z::\n \t\\0 line termination on output.\ndiff --git a/builtin/ls-tree.c b/builtin/ls-tree.c\nindex dc86b0d..7df87ec 100644\n--- a/builtin/ls-tree.c\n+++ b/builtin/ls-tree.c\n@@ -93,7 +93,7 @@ static int show_tree(const unsigned char *sha1, const char *base, int baselen,\n \tif (!(ls_options & LS_NAME_ONLY)) {\n \t\tif (ls_options & LS_SHOW_SIZE) {\n \t\t\tchar size_text[24];\n-\t\t\tif (!strcmp(type, blob_type)) {\n+\t\t\tif (!strcmp(type, blob_type) || !strcmp(type, tree_type)) {\n \t\t\t\tunsigned long size;\n \t\t\t\tif (sha1_object_info(sha1, &size) == OBJ_BAD)\n \t\t\t\t\tstrcpy(size_text, \"BAD\");\n-- \n1.7.1.rc1.69.g24c2f7\n"},{"id":"148089","messageId":"201008141640.14745.jnareb@gmail.com","threadId":"24738","inReplyTo":"1281730823-10797-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH] ls-tree: show size of trees with -l","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-08-14T14:40:11Z","receivedAt":"2010-08-14T14:40:11Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Fri, 13 Apr 2010, Nguyễn Thái Ngọc Duy wrote:\n\n> In commit a5bbda8 (Add an option to git-ls-tree to display also the\n> size of blob), Jakub said that size of non-blob entries had no\n> meaning therefore dashes were printed instead.\n\nI wrote that?\n\n> \n> I would say tree size, along with blob size, helps estimate bandwidth\n> needed to transfer a single commit, for example. Of course it's not\n> completely accurate as all objects will be compressed. But it gives a\n> rough figure to compare.\n> \n> Pack v4 has not come yet (and it's been three years, I truely hope it\n> will come next year). When it comes, I will gladly send a revert patch\n> of this one if it proves too expensive to compute tree size.\n> \n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> ---\n\nActually \"git ls-tree -l <tree-ish>\" doesn't show size of tree objects\nbecause packv4 was to be ready soon, and in packv4 trees would be stored\ndecomposed, so getting size of tree object (e.g. using git-cat-file) is\nwould be costly because git would have to re-generate tree object just \nto get its size (if it is in packfile).\n\nBut we don't have packv4 yet, even though it is 3 years since a5bbda8.\nIt looks like packv4 development moves with the speed of Perl 6 \ndevelopment.  But if Rakudo * (Perl 6 implementation) could have get \nreleased (even if it is developers release), then there is hope for \npackv4 yet... I hope...\n\n-- \nJakub Narebski\nPoland\n"}]}