Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-06-26 19:29:49 +0300
committerJunio C Hamano <gitster@pobox.com>2023-06-26 19:29:50 +0300
commite224f26892ffc3e2cb98fd68c6f74dc3d650ffc8 (patch)
tree96c5eda55c9f8f78c26f04c736823734216acfd2 /t/t7700-repack.sh
parent8d5c5a05d7abd67f8b667c888fe17783e1d676a5 (diff)
parent73320e49add4b56aba9bf5236a216498fa8ccc22 (diff)
Merge branch 'tb/collect-pack-filenames-fix'
Avoid breakage of "git pack-objects --cruft" due to inconsistency between the way the code enumerates packfiles in the repository. * tb/collect-pack-filenames-fix: builtin/repack.c: only collect fully-formed packs
Diffstat (limited to 't/t7700-repack.sh')
-rwxr-xr-xt/t7700-repack.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh
index 3f930fa476..af79266c58 100755
--- a/t/t7700-repack.sh
+++ b/t/t7700-repack.sh
@@ -10,6 +10,10 @@ test_description='git repack works correctly'
commit_and_pack () {
test_commit "$@" 1>&2 &&
incrpackid=$(git pack-objects --all --unpacked --incremental .git/objects/pack/pack </dev/null) &&
+ # Remove any loose object(s) created by test_commit, since they have
+ # already been packed. Leaving these around can create subtly different
+ # packs with `pack-objects`'s `--unpacked` option.
+ git prune-packed 1>&2 &&
echo pack-${incrpackid}.pack
}
@@ -209,6 +213,8 @@ test_expect_success 'repack --keep-pack' '
test_create_repo keep-pack &&
(
cd keep-pack &&
+ # avoid producing difference packs to delta/base choices
+ git config pack.window 0 &&
P1=$(commit_and_pack 1) &&
P2=$(commit_and_pack 2) &&
P3=$(commit_and_pack 3) &&
@@ -220,6 +226,23 @@ test_expect_success 'repack --keep-pack' '
grep -q $P1 new-counts &&
grep -q $P4 new-counts &&
test_line_count = 3 new-counts &&
+ git fsck &&
+
+ P5=$(commit_and_pack --no-tag 5) &&
+ git reset --hard HEAD^ &&
+ git reflog expire --all --expire=all &&
+ rm -f ".git/objects/pack/${P5%.pack}.idx" &&
+ rm -f ".git/objects/info/commit-graph" &&
+ for from in $(find .git/objects/pack -type f -name "${P5%.pack}.*")
+ do
+ to="$(dirname "$from")/.tmp-1234-$(basename "$from")" &&
+ mv "$from" "$to" || return 1
+ done &&
+
+ git repack --cruft -d --keep-pack $P1 --keep-pack $P4 &&
+
+ ls .git/objects/pack/*.pack >newer-counts &&
+ test_cmp new-counts newer-counts &&
git fsck
)
'