git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] t7700: demonstrate repack flaw which may loosen  objects unnecessarily
@ 2009-03-21 22:25 Brandon Casey
  2009-03-21 23:16 ` Brandon Casey
  0 siblings, 1 reply; 2+ messages in thread
From: Brandon Casey @ 2009-03-21 22:25 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

If an unreferenced object exists in both a local pack and in either a pack
residing in an alternate object database or a local kept pack, then the
pack-objects call made by repack will loosen that object only to have it
immediately pruned by repack's call to prune-packed.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
---


Signed version of the previous version.


 t/t7700-repack.sh |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh
index 1ef3892..013e488 100755
--- a/t/t7700-repack.sh
+++ b/t/t7700-repack.sh
@@ -113,5 +113,22 @@ test_expect_success 'packed unreachable obs in
alternate ODB are not loosened' '
 	test_must_fail git show $csha1
 '

+test_expect_failure 'local packed unreachable obs that exist in
alternate ODB are not loosened' '
+	echo `pwd`/alt_objects > .git/objects/info/alternates &&
+	echo "$csha1" | git pack-objects --non-empty --all --reflog pack &&
+	rm -f .git/objects/pack/* &&
+	mv pack-* .git/objects/pack/ &&
+	# The pack-objects call on the next line is equivalent to
+	# git repack -A -d without the call to prune-packed
+	git pack-objects --honor-pack-keep --non-empty --all --reflog \
+	    --unpack-unreachable </dev/null pack &&
+	rm -f .git/objects/pack/* &&
+	mv pack-* .git/objects/pack/ &&
+	test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx |
+		egrep "^$csha1 " | sort | uniq | wc -l) &&
+	echo > .git/objects/info/alternates &&
+	test_must_fail git show $csha1
+'
+
 test_done

-- 
1.6.2.12.g83676

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 1/2] t7700: demonstrate repack flaw which may loosen  objects unnecessarily
  2009-03-21 22:25 [PATCH v2 1/2] t7700: demonstrate repack flaw which may loosen objects unnecessarily Brandon Casey
@ 2009-03-21 23:16 ` Brandon Casey
  0 siblings, 0 replies; 2+ messages in thread
From: Brandon Casey @ 2009-03-21 23:16 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Man I just can't seem to get a patch off without issues.  I meant to
put these two comments in the patch emails.

1) Junio, these two patches are on top of 4d6acb70 which was the tip
of your jc/maint-1.6.0-keep-pack branch.

2) Also, note that this issue affects --keep-unreachable too, but the
fix is different since add_objects_in_unpacked_packs() just calls
add_object_entry() to add the unreachable objects to the list of
objects to pack and it (add_object_entry) already iterates on the pack
list.  One way to fix it, which feels very kludgy to me, is to
temporarily set 'local' to one before calling add_object_entry, so
that it will do nothing if the object is found in any non-local pack.
Unless I'm convinced it is worth it, I don't plan on fixing it.  I
doubt anyone uses --keep-unreachable manually.  It was invented to
make git-gc safe and has now been replaced by --unpack-unreachable.
So, --keep-unreachable may pack objects that it doesn't really need to
pack.  I can live with it.

-brandon


On Sat, Mar 21, 2009 at 5:25 PM, Brandon Casey <drafnel@gmail.com> wrote:
> If an unreferenced object exists in both a local pack and in either a pack
> residing in an alternate object database or a local kept pack, then the
> pack-objects call made by repack will loosen that object only to have it
> immediately pruned by repack's call to prune-packed.
>
> Signed-off-by: Brandon Casey <drafnel@gmail.com>
> ---

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-21 23:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-21 22:25 [PATCH v2 1/2] t7700: demonstrate repack flaw which may loosen objects unnecessarily Brandon Casey
2009-03-21 23:16 ` Brandon Casey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).