{"thread":{"id":"3377","subject":"[PATCH] git-repack question","startedAt":"2006-02-17T21:38:24Z","lastAt":"2006-02-18T06:50:09Z","messageCount":3,"participants":["linux@horizon.com","Linus Torvalds","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"16343","messageId":"20060217213824.5848.qmail@science.horizon.com","threadId":"3377","inReplyTo":null,"subject":"[PATCH] git-repack question","fromName":"","fromEmail":"linux@horizon.com","sentAt":"2006-02-17T21:38:24Z","receivedAt":"2006-02-17T21:38:24Z","isPatch":true,"sender":{"key":"linux@horizon.com","avatar":null},"body":"I'm trying to imagine when you'd want to run git-repack without the -d\noption, or without running git-prune-packed afterwards.\n(Isn't the idea behind packs to save space?)\n\nI'll leave changing the default to wiser heads, but this trivial patch\nwill at least allow the normal operations to be performed with one\ncommand.\n\nOh, and is the failure to support getopt-style concatenated\nsingle-letter options (git-repack -dp) a deliberate design feature\nof git, or just laziness?\n\n(Legalese: Patch placed in the public domain; copyright abandoned.)\n\n\ndiff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt\nindex 9060fe8..1b1f50d 100644\n--- a/Documentation/git-repack.txt\n+++ b/Documentation/git-repack.txt\n@@ -47,6 +47,10 @@ OPTIONS\n         Do not update the server information with\n         `git update-server-info`.\n \n+-p::\n+\tAfter packing, run gitlink:git-prune-packed[1] to delete\n+\tredundant unpacked objects.\n+\n Author\n ------\n Written by Linus Torvalds <torvalds@osdl.org>\ndiff --git a/git-repack.sh b/git-repack.sh\nindex 1fafb6e..361c7e9 100755\n--- a/git-repack.sh\n+++ b/git-repack.sh\n@@ -3,10 +3,10 @@\n # Copyright (c) 2005 Linus Torvalds\n #\n \n-USAGE='[-a] [-d] [-l] [-n]'\n+USAGE='[-a] [-d] [-l] [-n] [-p]'\n . git-sh-setup\n \t\n-no_update_info= all_into_one= remove_redundant= local=\n+no_update_info= all_into_one= remove_redundant= local= prune=\n while case \"$#\" in 0) break ;; esac\n do\n \tcase \"$1\" in\n@@ -14,6 +14,7 @@ do\n \t-a)\tall_into_one=t ;;\n \t-d)\tremove_redundant=t ;;\n \t-l)\tlocal=t ;;\n+\t-p)\tprune=t ;;\n \t*)\tusage ;;\n \tesac\n \tshift\n@@ -76,6 +77,10 @@ then\n \tfi\n fi\n \n+case \"$prune\" in\n+t) git-prune-packed ;;\n+esac\n+\n case \"$no_update_info\" in\n t) : ;;\n *) git-update-server-info ;;\n"},{"id":"16346","messageId":"Pine.LNX.4.64.0602171414220.916@g5.osdl.org","threadId":"3377","inReplyTo":"20060217213824.5848.qmail@science.horizon.com","subject":"Re: [PATCH] git-repack question","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-02-17T22:20:40Z","receivedAt":"2006-02-17T22:20:40Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Fri, 17 Feb 2006, linux@horizon.com wrote:\n>\n> I'm trying to imagine when you'd want to run git-repack without the -d\n> option, or without running git-prune-packed afterwards.\n> (Isn't the idea behind packs to save space?)\n\nNormally you'd always run git-prune-packed.\n\nThe reason it doesn't do that is simply being anally careful, and because \nconceptually the pruning phase is totally independent.\n\nFor example, in an environment that mirrors out git repositories by rsync, \nit can make sense to wait with pruning until the mirror cycle has \nfinished, so that all mirrors always have all the objects.\n\n(I don't do it for the kernel, because (a) I'm a lazy bastard, (b) I'm so \nconfused that I sometimes forget my own name, much less to prune things a \nday after I've repacked them and (c) I don't care that much about rsync \nanyway, since you can't avoid some of the _other_ races).\n\nAs to whether you'd normally run \"-d\" - usually you'd run it whenever you \npair it up with \"-a\". When you do an incremental re-pack, \"-d\" won't do \nanything anyway.\n\nAgain, it might make sense to not delete the old packs when repacking \neverything in a rsync'ing environment - or even in a shared repository, \nwhere removing a pack-file could race with somebody else working on it.\n\nBasically, the default ends up being to never remove any objects at all, \nsimply because that's the _safe_ thing to do.\n\nIn practice, I personally always do\n\n\tgit repack -a -d\n\tgit prune-packed\n\ntogether, because the full repack isn't _that_ expensive for me (I tend to \nhave lots of cpu power), and because I can't be bothered to worry too much \nabout rsync and there are never any other users working on my git trees.\n\n\t\tLinus\n"},{"id":"16361","messageId":"7virrdupni.fsf@assigned-by-dhcp.cox.net","threadId":"3377","inReplyTo":"20060217213824.5848.qmail@science.horizon.com","subject":"Re: [PATCH] git-repack question","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-18T06:50:09Z","receivedAt":"2006-02-18T06:50:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"linux@horizon.com writes:\n\n> (Legalese: Patch placed in the public domain; copyright abandoned.)\n\nThe rest of the patch looks good, but I'd rather prefer a patch\nwith a proper sign-off, strongly prefereable with a real name so\nthat we can attach blame on later when another SCO happens ;-).\n"}]}