summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-05-29 03:34:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-05-29 03:34:44 (GMT)
commit137a2613a07e556fd77fe374c6f4edd2d5e1b1fc (patch)
tree6c0353991d9dd1859212be80fed996bae70f7c6a /t
parent6b526ced6fb1808d1b8a9b30010e45dce10a4e7c (diff)
parentda5a1f81008f89f4e533006df8fa536e43c9c677 (diff)
downloadgit-137a2613a07e556fd77fe374c6f4edd2d5e1b1fc.zip
git-137a2613a07e556fd77fe374c6f4edd2d5e1b1fc.tar.gz
git-137a2613a07e556fd77fe374c6f4edd2d5e1b1fc.tar.bz2
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
Diffstat (limited to 't')
-rwxr-xr-xt/t5310-pack-bitmaps.sh48
1 files changed, 45 insertions, 3 deletions
diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh
index 424bec7..20e2473 100755
--- a/t/t5310-pack-bitmaps.sh
+++ b/t/t5310-pack-bitmaps.sh
@@ -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