{"thread":{"id":"2099","subject":"[PATCH 3/3] Add \"-l\" flag for repacking only local packs","startedAt":"2005-10-13T21:30:29Z","lastAt":"2005-10-13T21:30:29Z","messageCount":1,"participants":["Linus Torvalds"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"10084","messageId":"Pine.LNX.4.64.0510131427030.23590@g5.osdl.org","threadId":"2099","inReplyTo":null,"subject":"[PATCH 3/3] Add \"-l\" flag for repacking only local packs","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-10-13T21:30:29Z","receivedAt":"2005-10-13T21:30:29Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\nThis uses the new \"--local\" flag to git-pack-objects.  It currently only\nmakes a difference together with \"-a\", since a normal incremental repack\nwon't pack any packed objects at all (whether local or remote). \n\nEventually, it might end up skipping any objects that aren't local to\nthe current object directory, but for now it only knows to skip packed\nobjects. \n\nSigned-off-by: Linus Torvalds <torvalds@osdl.org>\n---\n\nOk, that was the last of it. I tested it out by doing a\n\n\tgit clone -l -s git newgit\n\tcd newgit\n\t.. do a dummy commit ..\n\tgit repack -a -d -l\n\nand then\n\n\tcd ../git\n\tgit repack -a -d\n\n\tcd ../newgit\n\tgit repack -a -d -l\n\nand verified that the repacks in \"newgit\" all seemed to do the right thing \n(ie they only repacked objects that weren't packed in the original git, \nand repacking the original git archive caused the repack in the new one to \nshrink considerably).\n\nThis means that my suggested automatic repacking should work fine with \nalternate object directories too, except my second script (the periodic \nfull repack) would needs to be updated to use the new \"-l\" flag.\n\ndiff --git a/git-repack.sh b/git-repack.sh\nindex b395d0e..49547a7 100755\n--- a/git-repack.sh\n+++ b/git-repack.sh\n@@ -5,13 +5,14 @@\n \n . git-sh-setup || die \"Not a git archive\"\n \t\n-no_update_info= all_into_one= remove_redundant=\n+no_update_info= all_into_one= remove_redundant= local=\n while case \"$#\" in 0) break ;; esac\n do\n \tcase \"$1\" in\n \t-n)\tno_update_info=t ;;\n \t-a)\tall_into_one=t ;;\n \t-d)\tremove_redandant=t ;;\n+\t-l)\tlocal=t ;;\n \t*)\tbreak ;;\n \tesac\n \tshift\n@@ -37,6 +38,9 @@ case \",$all_into_one,\" in\n \t    find . -type f \\( -name '*.pack' -o -name '*.idx' \\) -print`\n \t;;\n esac\n+if [ \"$local\" ]; then\n+\tpack_objects=\"$pack_objects --local\"\n+fi\n name=$(git-rev-list --objects $rev_list $(git-rev-parse $rev_parse) |\n \tgit-pack-objects --non-empty $pack_objects .tmp-pack) ||\n \texit 1\n"}]}