Skip to content

Commit 3c3df42

Browse files
drafnelgitster
authored andcommitted
t7700: demonstrate mishandling of loose objects in an alternate ODB
Loose objects residing in an alternate object database should not be packed when the -l option to repack is used. Signed-off-by: Brandon Casey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 01af249 commit 3c3df42

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

t/t7700-repack.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,24 @@ test_expect_success 'objects in packs marked .keep are not repacked' '
3434
test -z "$found_duplicate_object"
3535
'
3636

37+
test_expect_failure 'loose objects in alternate ODB are not repacked' '
38+
mkdir alt_objects &&
39+
echo `pwd`/alt_objects > .git/objects/info/alternates &&
40+
echo content3 > file3 &&
41+
objsha1=$(GIT_OBJECT_DIRECTORY=alt_objects git hash-object -w file3) &&
42+
git add file3 &&
43+
git commit -m commit_file3 &&
44+
git repack -a -d -l &&
45+
git prune-packed &&
46+
for p in .git/objects/pack/*.idx; do
47+
if git verify-pack -v $p | egrep "^$objsha1"; then
48+
found_duplicate_object=1
49+
echo "DUPLICATE OBJECT FOUND"
50+
break
51+
fi
52+
done &&
53+
test -z "$found_duplicate_object"
54+
'
55+
3756
test_done
3857

0 commit comments

Comments
 (0)