提交 137a2613 编写于 作者: J Junio C Hamano

Merge branch 'jk/disable-pack-reuse-when-broken'

"pack-objects" can stream a slice of an existing packfile out when
the pack bitmap can tell that the reachable objects are all needed
in the output, without inspecting individual objects.  This
strategy however would not work well when "--local" and other
options are in use, and need to be disabled.

* jk/disable-pack-reuse-when-broken:
  t5310: fix "; do" style
  pack-objects: disable pack reuse for object-selection options
...@@ -2728,7 +2728,11 @@ static void loosen_unused_packed_objects(struct rev_info *revs) ...@@ -2728,7 +2728,11 @@ static void loosen_unused_packed_objects(struct rev_info *revs)
*/ */
static int pack_options_allow_reuse(void) static int pack_options_allow_reuse(void)
{ {
return pack_to_stdout && allow_ofs_delta; return pack_to_stdout &&
allow_ofs_delta &&
!ignore_packed_keep &&
(!local || !have_non_local_packs) &&
!incremental;
} }
static int get_object_list_from_bitmap(struct rev_info *revs) static int get_object_list_from_bitmap(struct rev_info *revs)
......
...@@ -20,11 +20,13 @@ has_any () { ...@@ -20,11 +20,13 @@ has_any () {
} }
test_expect_success 'setup repo with moderate-sized history' ' test_expect_success 'setup repo with moderate-sized history' '
for i in $(test_seq 1 10); do for i in $(test_seq 1 10)
do
test_commit $i test_commit $i
done && done &&
git checkout -b other HEAD~5 && git checkout -b other HEAD~5 &&
for i in $(test_seq 1 10); do for i in $(test_seq 1 10)
do
test_commit side-$i test_commit side-$i
done && done &&
git checkout master && git checkout master &&
...@@ -104,7 +106,8 @@ test_expect_success 'clone from bitmapped repository' ' ...@@ -104,7 +106,8 @@ test_expect_success 'clone from bitmapped repository' '
' '
test_expect_success 'setup further non-bitmapped commits' ' test_expect_success 'setup further non-bitmapped commits' '
for i in $(test_seq 1 10); do for i in $(test_seq 1 10)
do
test_commit further-$i test_commit further-$i
done done
' '
...@@ -289,4 +292,43 @@ test_expect_success 'splitting packs does not generate bogus bitmaps' ' ...@@ -289,4 +292,43 @@ test_expect_success 'splitting packs does not generate bogus bitmaps' '
git -C no-bitmaps.git fetch .. HEAD git -C no-bitmaps.git fetch .. HEAD
' '
test_expect_success 'set up reusable pack' '
rm -f .git/objects/pack/*.keep &&
git repack -adb &&
reusable_pack () {
git for-each-ref --format="%(objectname)" |
git pack-objects --delta-base-offset --revs --stdout "$@"
}
'
test_expect_success 'pack reuse respects --honor-pack-keep' '
test_when_finished "rm -f .git/objects/pack/*.keep" &&
for i in .git/objects/pack/*.pack
do
>${i%.pack}.keep
done &&
reusable_pack --honor-pack-keep >empty.pack &&
git index-pack empty.pack &&
>expect &&
git show-index <empty.idx >actual &&
test_cmp expect actual
'
test_expect_success 'pack reuse respects --local' '
mv .git/objects/pack/* alt.git/objects/pack/ &&
test_when_finished "mv alt.git/objects/pack/* .git/objects/pack/" &&
reusable_pack --local >empty.pack &&
git index-pack empty.pack &&
>expect &&
git show-index <empty.idx >actual &&
test_cmp expect actual
'
test_expect_success 'pack reuse respects --incremental' '
reusable_pack --incremental >empty.pack &&
git index-pack empty.pack &&
>expect &&
git show-index <empty.idx >actual &&
test_cmp expect actual
'
test_done test_done
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册