{"thread":{"id":"17069","subject":"[PATCH] t7700: demonstrate misbehavior of 'repack -a' when local packs exist","startedAt":"2009-01-09T22:14:39Z","lastAt":"2009-01-09T22:14:39Z","messageCount":1,"participants":["Brandon Casey"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"99822","messageId":"rjZ2Q9koCqY3UL6iGB8a-6LSgDb7keG498cZLN5piAaXDVuhlLM0Jhi-Qkjb7AimF_xZvap4QIk@cipher.nrlssc.navy.mil","threadId":"17069","inReplyTo":null,"subject":"[PATCH] t7700: demonstrate misbehavior of 'repack -a' when local packs exist","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-01-09T22:14:39Z","receivedAt":"2009-01-09T22:14:39Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"The ability to \"...fatten [the] local repository by packing everything that\nis needed by the local ref into a single new pack, including things that are\nborrowed from alternates\"[1] is supposed to be provided by the '-a' or '-A'\noptions to repack when '-l' is not used, but there is a flaw.  For each\npack in the local repository without a .keep file, repack supplies a\n--unpacked=<pack> argument to pack-objects.\n\nThe --unpacked option to pack-objects, with or without an argument, causes\npack-objects to ignore any object which is packed in a pack not mentioned\nin an argument to --unpacked=.  So, if there are local packs, and\n'repack -a' is called, then any objects which reside in packs accessible\nthrough alternates will _not_ be packed.  If there are no local packs, then\nno --unpacked argument will be supplied, and repack will behave as expected.\n\n[1] http://mid.gmane.org/7v8wrwidi3.fsf@gitster.siamese.dyndns.org\n\nSigned-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n---\n\n\nFYI: I won't be looking in to a fix for this immediately. So if someone else\n     has time and the inclination, please be my guest. Also, you can thank a\n     transformer blow, and lots of disk loss for the discovery of this bug.\n\n-brandon\n\n\n t/t7700-repack.sh |   19 +++++++++++++++++++\n 1 files changed, 19 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t7700-repack.sh b/t/t7700-repack.sh\nindex 3f602ea..f5682d6 100755\n--- a/t/t7700-repack.sh\n+++ b/t/t7700-repack.sh\n@@ -69,5 +69,24 @@ test_expect_success 'packed obs in alt ODB are repacked even when local repo is\n \tdone\n '\n \n+test_expect_failure 'packed obs in alt ODB are repacked when local repo has packs' '\n+\trm -f .git/objects/pack/* &&\n+\techo new_content >> file1 &&\n+\tgit add file1 &&\n+\tgit commit -m more_content &&\n+\tgit repack &&\n+\tgit repack -a -d &&\n+\tmyidx=$(ls -1 .git/objects/pack/*.idx) &&\n+\ttest -f \"$myidx\" &&\n+\tfor p in alt_objects/pack/*.idx; do\n+\t\tgit verify-pack -v $p | sed -n -e \"/^[0-9a-f]\\{40\\}/p\"\n+\tdone | while read sha1 rest; do\n+\t\tif ! ( git verify-pack -v $myidx | grep \"^$sha1\" ); then\n+\t\t\techo \"Missing object in local pack: $sha1\"\n+\t\t\treturn 1\n+\t\tfi\n+\tdone\n+'\n+\n test_done\n \n-- \n1.6.1.76.gc123b\n"}]}