{"thread":{"id":"3124","subject":"[PATCH] Add git-pack-ls-objects tool","startedAt":"2006-01-22T02:27:11Z","lastAt":"2006-01-22T03:00:42Z","messageCount":3,"participants":["Petr Baudis","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"15018","messageId":"20060122022711.16333.93404.stgit@machine.or.cz","threadId":"3124","inReplyTo":null,"subject":"[PATCH] Add git-pack-ls-objects tool","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-01-22T02:27:11Z","receivedAt":"2006-01-22T02:27:11Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"This tool takes pack index on stdin and produces the list of indexed\nobjects on stdout.\n\nVery simple, but I've been always somewhat nervous that I cannot list\nall (even unreferenced) objects in a repository, and in a given pack in\nparticular. The immediate use will be in the git-count-objects script,\nbut I can imagine it being useful also in various troubleshooting\nsituations.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n---\n\n Documentation/git-pack-ls-objects.txt |   32 ++++++++++++++++++++++++++++++++\n Makefile                              |    2 +-\n pack-ls-objects.c                     |   31 +++++++++++++++++++++++++++++++\n 3 files changed, 64 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-pack-ls-objects.txt b/Documentation/git-pack-ls-objects.txt\nnew file mode 100644\nindex 0000000..bf2a4a4\n--- /dev/null\n+++ b/Documentation/git-pack-ls-objects.txt\n@@ -0,0 +1,32 @@\n+git-pack-ls-objects(1)\n+======================\n+\n+NAME\n+----\n+git-pack-ls-objects - List objects in a pack based on its index\n+\n+\n+SYNOPSIS\n+--------\n+'git-pack-ls-objects' < pack-index\n+\n+\n+DESCRIPTION\n+-----------\n+Reads a packed archive index (.idx) from its standard input and\n+produces the list of indexed objects (that is, the objects packed\n+in the corresponding .pack file) on its standard output.\n+\n+\n+Author\n+------\n+Written by Petr Baudis <pasky@suse.cz>\n+\n+Documentation\n+-------------\n+Documentation by Petr Baudis\n+\n+GIT\n+---\n+Part of the gitlink:git[7] suite\n+\ndiff --git a/Makefile b/Makefile\nindex a291bb1..7c54507 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -143,7 +143,7 @@ PROGRAMS = \\\n \tgit-upload-pack$X git-verify-pack$X git-write-tree$X \\\n \tgit-update-ref$X git-symbolic-ref$X git-check-ref-format$X \\\n \tgit-name-rev$X git-pack-redundant$X git-repo-config$X git-var$X \\\n-\tgit-describe$X\n+\tgit-describe$X git-pack-ls-objects$X\n \n # what 'all' will build and 'install' will install, in gitexecdir\n ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)\ndiff --git a/pack-ls-objects.c b/pack-ls-objects.c\nnew file mode 100644\nindex 0000000..caee59c\n--- /dev/null\n+++ b/pack-ls-objects.c\n@@ -0,0 +1,31 @@\n+/*\n+ * GIT - The information manager from hell\n+ *\n+ * Copyright (C) Petr Baudis, 2006\n+ */\n+\n+#include <stdio.h>\n+#include \"cache.h\"\n+\n+static const char pack_usage[] = \"git-pack-ls-objects < pack-idx\";\n+\n+int main(int argc, char **argv)\n+{\n+\tunsigned char buf[1024];\n+\tunsigned char entry[24];\n+\n+\tif (argc > 1)\n+\t\tusage(pack_usage);\n+\n+\t/* We are doing these charades because we do not want to print\n+\t * the last sha1. */\n+\n+\tif (!fread(buf, 256 * 4, 1, stdin) || !fread(entry, 24, 1, stdin))\n+\t\tdie(\"invalid pack index\");\n+\n+\twhile (fread(buf, 24, 1, stdin)) {\n+\t\tprintf(\"%s\\n\", sha1_to_hex(entry + 4));\n+\t\tmemcpy(entry, buf, 24);\n+\t}\n+\treturn 0;\n+}\n"},{"id":"15021","messageId":"7vzmlphtct.fsf@assigned-by-dhcp.cox.net","threadId":"3124","inReplyTo":"20060122022711.16333.93404.stgit@machine.or.cz","subject":"Re: [PATCH] Add git-pack-ls-objects tool","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-22T02:46:58Z","receivedAt":"2006-01-22T02:46:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n> This tool takes pack index on stdin and produces the list of indexed\n> objects on stdout.\n\nIsn't this essentially what git-show-index does?\n"},{"id":"15023","messageId":"20060122030042.GS28365@pasky.or.cz","threadId":"3124","inReplyTo":"7vzmlphtct.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Add git-pack-ls-objects tool","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-01-22T03:00:42Z","receivedAt":"2006-01-22T03:00:42Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, Jan 22, 2006 at 03:46:58AM CET, I got a letter\nwhere Junio C Hamano <junkio@cox.net> said that...\n> Petr Baudis <pasky@suse.cz> writes:\n> \n> > This tool takes pack index on stdin and produces the list of indexed\n> > objects on stdout.\n> \n> Isn't this essentially what git-show-index does?\n\nYes, I just had no idea this existed. ;)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nOf the 3 great composers Mozart tells us what it's like to be human,\nBeethoven tells us what it's like to be Beethoven and Bach tells us\nwhat it's like to be the universe.  -- Douglas Adams\n"}]}