{"thread":{"id":"18455","subject":"[PATCH v2 1/2] t7700: demonstrate repack flaw which may loosen objects unnecessarily","startedAt":"2009-03-21T22:25:30Z","lastAt":"2009-03-21T23:16:58Z","messageCount":2,"participants":["Brandon Casey"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"108843","messageId":"ee63ef30903211525q4a95a27eoa4e95c7954e5cc93@mail.gmail.com","threadId":"18455","inReplyTo":null,"subject":"[PATCH v2 1/2] t7700: demonstrate repack flaw which may loosen objects unnecessarily","fromName":"Brandon Casey","fromEmail":"drafnel@gmail.com","sentAt":"2009-03-21T22:25:30Z","receivedAt":"2009-03-21T22:25:30Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"If an unreferenced object exists in both a local pack and in either a pack\nresiding in an alternate object database or a local kept pack, then the\npack-objects call made by repack will loosen that object only to have it\nimmediately pruned by repack's call to prune-packed.\n\nSigned-off-by: Brandon Casey <drafnel@gmail.com>\n---\n\n\nSigned version of the previous version.\n\n\n t/t7700-repack.sh |   17 +++++++++++++++++\n 1 files changed, 17 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t7700-repack.sh b/t/t7700-repack.sh\nindex 1ef3892..013e488 100755\n--- a/t/t7700-repack.sh\n+++ b/t/t7700-repack.sh\n@@ -113,5 +113,22 @@ test_expect_success 'packed unreachable obs in\nalternate ODB are not loosened' '\n \ttest_must_fail git show $csha1\n '\n\n+test_expect_failure 'local packed unreachable obs that exist in\nalternate ODB are not loosened' '\n+\techo `pwd`/alt_objects > .git/objects/info/alternates &&\n+\techo \"$csha1\" | git pack-objects --non-empty --all --reflog pack &&\n+\trm -f .git/objects/pack/* &&\n+\tmv pack-* .git/objects/pack/ &&\n+\t# The pack-objects call on the next line is equivalent to\n+\t# git repack -A -d without the call to prune-packed\n+\tgit pack-objects --honor-pack-keep --non-empty --all --reflog \\\n+\t    --unpack-unreachable </dev/null pack &&\n+\trm -f .git/objects/pack/* &&\n+\tmv pack-* .git/objects/pack/ &&\n+\ttest 0 = $(git verify-pack -v -- .git/objects/pack/*.idx |\n+\t\tegrep \"^$csha1 \" | sort | uniq | wc -l) &&\n+\techo > .git/objects/info/alternates &&\n+\ttest_must_fail git show $csha1\n+'\n+\n test_done\n\n-- \n1.6.2.12.g83676\n"},{"id":"108851","messageId":"ee63ef30903211616pdf9fdal51dda518dd3cfec@mail.gmail.com","threadId":"18455","inReplyTo":"ee63ef30903211525q4a95a27eoa4e95c7954e5cc93@mail.gmail.com","subject":"Re: [PATCH v2 1/2] t7700: demonstrate repack flaw which may loosen objects unnecessarily","fromName":"Brandon Casey","fromEmail":"drafnel@gmail.com","sentAt":"2009-03-21T23:16:58Z","receivedAt":"2009-03-21T23:16:58Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Man I just can't seem to get a patch off without issues.  I meant to\nput these two comments in the patch emails.\n\n1) Junio, these two patches are on top of 4d6acb70 which was the tip\nof your jc/maint-1.6.0-keep-pack branch.\n\n2) Also, note that this issue affects --keep-unreachable too, but the\nfix is different since add_objects_in_unpacked_packs() just calls\nadd_object_entry() to add the unreachable objects to the list of\nobjects to pack and it (add_object_entry) already iterates on the pack\nlist.  One way to fix it, which feels very kludgy to me, is to\ntemporarily set 'local' to one before calling add_object_entry, so\nthat it will do nothing if the object is found in any non-local pack.\nUnless I'm convinced it is worth it, I don't plan on fixing it.  I\ndoubt anyone uses --keep-unreachable manually.  It was invented to\nmake git-gc safe and has now been replaced by --unpack-unreachable.\nSo, --keep-unreachable may pack objects that it doesn't really need to\npack.  I can live with it.\n\n-brandon\n\n\nOn Sat, Mar 21, 2009 at 5:25 PM, Brandon Casey <drafnel@gmail.com> wrote:\n> If an unreferenced object exists in both a local pack and in either a pack\n> residing in an alternate object database or a local kept pack, then the\n> pack-objects call made by repack will loosen that object only to have it\n> immediately pruned by repack's call to prune-packed.\n>\n> Signed-off-by: Brandon Casey <drafnel@gmail.com>\n> ---\n"}]}