mirror of
https://github.com/git/git.git
synced 2024-11-24 10:26:17 +08:00
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
This commit is contained in:
commit
137a2613a0
@ -2728,7 +2728,11 @@ static void loosen_unused_packed_objects(struct rev_info *revs)
|
||||
*/
|
||||
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)
|
||||
|
@ -20,11 +20,13 @@ has_any () {
|
||||
}
|
||||
|
||||
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
|
||||
done &&
|
||||
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
|
||||
done &&
|
||||
git checkout master &&
|
||||
@ -104,7 +106,8 @@ test_expect_success 'clone from bitmapped repository' '
|
||||
'
|
||||
|
||||
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
|
||||
done
|
||||
'
|
||||
@ -289,4 +292,43 @@ test_expect_success 'splitting packs does not generate bogus bitmaps' '
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user