Skip to content

Commit 87db667

Browse files
derrickstoleedscho
authored andcommitted
t5309: create failing test for 'git index-pack'
This new test demonstrates some behavior where a valid packfile is being rejected by the Git client due to the order in which it is resolving REF_DELTAs. The thin packfile has a REF_DELTA chain A->B->C where C is not included in the packfile. However, the client repository contains both C and B already. Thus, 'git index-pack' is able to resolve A before resolving B. When resolving B, it then attempts to resolve any other REF_DELTAs that are pointing to B as a base. This "revisits" A and complains as if there is a cycle, but it did not actually detect a cycle. A fix will arrive in the next change. Signed-off-by: Derrick Stolee <[email protected]>
1 parent 6bc610b commit 87db667

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

t/t5309-pack-delta-cycles.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,30 @@ test_expect_success 'failover to a duplicate object in the same pack' '
7575
test_must_fail git index-pack --fix-thin --stdin <recoverable.pack
7676
'
7777

78+
test_expect_failure 'index-pack works with thin pack A->B->C with B on disk' '
79+
git init server &&
80+
(
81+
cd server &&
82+
test_commit_bulk 4
83+
) &&
84+
85+
A=$(git -C server rev-parse HEAD^{tree}) &&
86+
B=$(git -C server rev-parse HEAD~1^{tree}) &&
87+
C=$(git -C server rev-parse HEAD~2^{tree}) &&
88+
git -C server reset --hard HEAD~1 &&
89+
90+
cat >in <<-EOF &&
91+
REF_DELTA $A $B
92+
REF_DELTA $B $C
93+
EOF
94+
95+
test-tool -C server pack-deltas 2 <in >thin.pack &&
96+
97+
git clone "file://$(pwd)/server" client &&
98+
(
99+
cd client &&
100+
git index-pack --fix-thin --stdin <../thin.pack
101+
)
102+
'
103+
78104
test_done

0 commit comments

Comments
 (0)