{"thread":{"id":"8467","subject":"[PATCH] Add git-index-pack -l to list objects in a pack","startedAt":"2007-06-06T09:39:41Z","lastAt":"2007-06-06T21:35:45Z","messageCount":4,"participants":["Sam Vilain","Nicolas Pitre","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"44152","messageId":"11811227811793-git-send-email-sam.vilain@catalyst.net.nz","threadId":"8467","inReplyTo":null,"subject":"[PATCH] Add git-index-pack -l to list objects in a pack","fromName":"Sam Vilain","fromEmail":"sam.vilain@catalyst.net.nz","sentAt":"2007-06-06T09:39:41Z","receivedAt":"2007-06-06T09:39:41Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"I couldn't figure out how to make git-unpack-objects -n work.\nBut it seems to be easy in the loop in index-pack\n---\n index-pack.c |    8 +++++++-\n 1 files changed, 7 insertions(+), 1 deletions(-)\n\ndiff --git a/index-pack.c b/index-pack.c\nindex 82c8da3..f657db7 100644\n--- a/index-pack.c\n+++ b/index-pack.c\n@@ -45,6 +45,7 @@ static int nr_resolved_deltas;\n \n static int from_stdin;\n static int verbose;\n+static int list_objects;\n \n static struct progress progress;\n \n@@ -717,6 +718,8 @@ int main(int argc, char **argv)\n \t\t\t\tif (*c)\n \t\t\t\t\tdie(\"bad %s\", arg);\n \t\t\t\tinput_len = sizeof(*hdr);\n+\t\t\t} else if (!strcmp(arg, \"-l\")) {\n+\t\t\t\tlist_objects = 1;\n \t\t\t} else if (!strcmp(arg, \"-v\")) {\n \t\t\t\tverbose = 1;\n \t\t\t} else if (!strcmp(arg, \"-o\")) {\n@@ -802,8 +805,11 @@ int main(int argc, char **argv)\n \tfree(deltas);\n \n \tidx_objects = xmalloc((nr_objects) * sizeof(struct pack_idx_entry *));\n-\tfor (i = 0; i < nr_objects; i++)\n+\tfor (i = 0; i < nr_objects; i++) {\n \t\tidx_objects[i] = &objects[i].idx;\n+\t\tif (list_objects)\n+\t\t\tprintf(\"%s\\n\", sha1_to_hex(idx_objects[i]->sha1));\n+\t}\n \tcurr_index = write_idx_file(index_name, idx_objects, nr_objects, sha1);\n \tfree(idx_objects);\n \n-- \n1.5.2.0.45.gfea6d-dirty\n"},{"id":"44163","messageId":"alpine.LFD.0.99.0706060952410.12885@xanadu.home","threadId":"8467","inReplyTo":"11811227811793-git-send-email-sam.vilain@catalyst.net.nz","subject":"Re: [PATCH] Add git-index-pack -l to list objects in a pack","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-06-06T13:55:18Z","receivedAt":"2007-06-06T13:55:18Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Wed, 6 Jun 2007, Sam Vilain wrote:\n\n> I couldn't figure out how to make git-unpack-objects -n work.\n> But it seems to be easy in the loop in index-pack\n\nWhy don't you simply use git-show-index?\n\n\nNicolas\n"},{"id":"44192","messageId":"466725C4.5090707@catalyst.net.nz","threadId":"8467","inReplyTo":"alpine.LFD.0.99.0706060952410.12885@xanadu.home","subject":"Re: [PATCH] Add git-index-pack -l to list objects in a pack","fromName":"Sam Vilain","fromEmail":"sam.vilain@catalyst.net.nz","sentAt":"2007-06-06T21:23:16Z","receivedAt":"2007-06-06T21:23:16Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Nicolas Pitre wrote:\n>> I couldn't figure out how to make git-unpack-objects -n work.\n>> But it seems to be easy in the loop in index-pack\n> \n> Why don't you simply use git-show-index?\n\nBecause I found the enticing -n switch in the documentation first?\n\nThat command certainly would have done the trick for what I needed it\nto do.  Perhaps change the documentation of the switch?\n\nSubject: [PATCH] fix documentation of unpack-objects -n\n\nunpack-objects -n didn't print the object list as promised on the\nmanual page, so alter the documentation to reflect the behaviour\n---\n Documentation/git-unpack-objects.txt |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-unpack-objects.txt b/Documentation/git-unpack-objects.txt\nindex ff6184b..b1b3ec9 100644\n--- a/Documentation/git-unpack-objects.txt\n+++ b/Documentation/git-unpack-objects.txt\n@@ -27,8 +27,8 @@ new packs and replace existing ones.\n OPTIONS\n -------\n -n::\n-        Only list the objects that would be unpacked, don't actually unpack\n-        them.\n+        Dry run.  Check the pack file without actually unpacking\n+\tthe objects.\n \n -q::\n \tThe command usually shows percentage progress.  This\n-- \n1.5.2.0.45.gfea6d-dirty\n"},{"id":"44194","messageId":"7vtztkyde6.fsf@assigned-by-dhcp.cox.net","threadId":"8467","inReplyTo":"466725C4.5090707@catalyst.net.nz","subject":"Re: [PATCH] Add git-index-pack -l to list objects in a pack","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-06T21:35:45Z","receivedAt":"2007-06-06T21:35:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sam Vilain <sam.vilain@catalyst.net.nz> writes:\n\n> Nicolas Pitre wrote:\n>>> I couldn't figure out how to make git-unpack-objects -n work.\n>>> But it seems to be easy in the loop in index-pack\n>> \n>> Why don't you simply use git-show-index?\n>\n> Because I found the enticing -n switch in the documentation first?\n>\n> That command certainly would have done the trick for what I needed it\n> to do.  Perhaps change the documentation of the switch?\n\nI think this is \"incorrect expectation\".  The document says:\n\n>  -n::\n> -        Only list the objects that would be unpacked, don't actually unpack\n> -        them.\n\nI suspect that you were trying to unpack in a repository that\nalready had that object?  They are not \"the objects that would\nbe unpacked\" hence not listed.\n"}]}