{"thread":{"id":"2596","subject":"[PATCH] Document the \"ignore objects\" feature of git-pack-redundant","startedAt":"2005-11-18T22:17:50Z","lastAt":"2005-11-21T11:45:22Z","messageCount":3,"participants":["Lukas Sandström"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"12275","messageId":"437E530E.1020803@etek.chalmers.se","threadId":"2596","inReplyTo":null,"subject":"[PATCH] Make git-pack-redundant take a list of unimportant objs on stdin","fromName":"Lukas Sandström","fromEmail":"lukass@etek.chalmers.se","sentAt":"2005-11-18T22:17:50Z","receivedAt":"2005-11-18T22:17:50Z","isPatch":true,"sender":{"key":"luksan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/152281?v=4"},"body":"This lets us do \"git-fsck-objects --full --unreachable | cut -d ' ' -f3 |\ngit-pack-redundant --all\", which will keep git-pack-redundant from keeping\npacks just because they contain unreachable objects.\n\nAlso add some more --verbose output.\n\nSigned-off-by: Lukas Sandström <lukass@etek.chalmers.se>\n\n---\n\n pack-redundant.c |   21 +++++++++++++++++++++\n 1 files changed, 21 insertions(+), 0 deletions(-)\n\napplies-to: 3771756c044fa4338acc9f6acac3971f2309cc7c\n4173f0c77793b13ad50d9c1a1ff5da32fec5e573\ndiff --git a/pack-redundant.c b/pack-redundant.c\nindex fb6cb48..f3097a1 100644\n--- a/pack-redundant.c\n+++ b/pack-redundant.c\n@@ -579,6 +579,8 @@ int main(int argc, char **argv)\n {\n \tint i;\n \tstruct pack_list *min, *red, *pl;\n+\tstruct llist *ignore;\n+\tchar *sha1, buf[42]; /* 40 byte sha1 + \\n + \\0 */\n \n \tfor (i = 1; i < argc; i++) {\n \t\tconst char *arg = argv[i];\n@@ -621,6 +623,23 @@ int main(int argc, char **argv)\n \tif (alt_odb)\n \t\tscan_alt_odb_packs();\n \n+\t/* ignore objects given on stdin */\n+\tllist_init(&ignore);\n+\tif (!isatty(0)) {\n+\t\twhile (fgets(buf, sizeof(buf), stdin)) {\n+\t\t\tsha1 = xmalloc(20);\n+\t\t\tif (get_sha1_hex(buf, sha1))\n+\t\t\t\tdie(\"Bad sha1 on stdin: %s\", buf);\n+\t\t\tllist_insert_sorted_unique(ignore, sha1, NULL);\n+\t\t}\n+\t}\n+\tllist_sorted_difference_inplace(all_objects, ignore);\n+\tpl = local_packs;\n+\twhile (pl) {\n+\t\tllist_sorted_difference_inplace(pl->unique_objects, ignore);\n+\t\tpl = pl->next;\n+\t}\n+\n \tminimize(&min);\n \n \tif (verbose) {\n@@ -647,6 +666,8 @@ int main(int argc, char **argv)\n \t\t       pl->pack->pack_name);\n \t\tpl = pl->next;\n \t}\n+\tif (verbose)\n+\t\tfprintf(stderr, \"%luMB of redundant packs in total.\\n\", pack_set_bytecount(red)/(1024*1024));\n \n \treturn 0;\n }\n---\n0.99.9.GIT\n"},{"id":"12267","messageId":"437E539F.6080304@etek.chalmers.se","threadId":"2596","inReplyTo":"437E530E.1020803@etek.chalmers.se","subject":"[PATCH] Document the \"ignore objects\" feature of git-pack-redundant","fromName":"Lukas Sandström","fromEmail":"lukass@etek.chalmers.se","sentAt":"2005-11-18T22:20:15Z","receivedAt":"2005-11-18T22:20:15Z","isPatch":true,"sender":{"key":"luksan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/152281?v=4"},"body":"Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>\n\n---\n\n Documentation/git-pack-redundant.txt |    8 ++++++++\n 1 files changed, 8 insertions(+), 0 deletions(-)\n\napplies-to: 5053091ee7d1f4b32b18a21f4b255cf1141cf72c\ne417344dab21aca41fbc1f99d935ef033e53e3a8\ndiff --git a/Documentation/git-pack-redundant.txt b/Documentation/git-pack-redundant.txt\nindex 2e23cbc..9fe86ae 100644\n--- a/Documentation/git-pack-redundant.txt\n+++ b/Documentation/git-pack-redundant.txt\n@@ -16,6 +16,14 @@ This program computes which packs in you\n are redundant. The output is suitable for piping to\n 'xargs rm' if you are in the root of the repository.\n \n+git-pack-redundant accepts a list of objects on standard input. Any objects\n+given will be ignored when checking which packs are required. This makes the \n+following command useful when wanting to remove packs which contain unreachable\n+objects.\n+\n+git-fsck-objects --full --unreachable | cut -d ' ' -f3 | \\\n+git-pack-redundant --all | xargs rm\n+\n OPTIONS\n -------\n \n---\n0.99.9.GIT\n"},{"id":"12428","messageId":"4381B352.20107@etek.chalmers.se","threadId":"2596","inReplyTo":"437E530E.1020803@etek.chalmers.se","subject":"Re: [PATCH] Make git-pack-redundant take a list of unimportant objs on stdin","fromName":"Lukas Sandström","fromEmail":"lukass@etek.chalmers.se","sentAt":"2005-11-21T11:45:22Z","receivedAt":"2005-11-21T11:45:22Z","isPatch":true,"sender":{"key":"luksan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/152281?v=4"},"body":"Lukas Sandström wrote:\n> This lets us do \"git-fsck-objects --full --unreachable | cut -d ' ' -f3 |\n> git-pack-redundant --all\", which will keep git-pack-redundant from keeping\n> packs just because they contain unreachable objects.\n> \n> Also add some more --verbose output.\n> \n> Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>\n> \n\nThe patch which documents this feature was committed (9a888b758f48d88d1e83c9765e33d4452710d5a5),\nbut not the feature. Did you just miss the patch, or is there something wrong with it?\n\n/Lukas\n"}]}