Skip to content

Commit acede2e

Browse files
mhaggergitster
authored andcommitted
t5700: document a failure of alternates to affect fetch
If an alternate supplies some, but not all, of the objects needed for a fetch, fetch-pack nevertheless generates "want" lines for the alternate objects that are present. Demonstrate this problem via a failing test. Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b6b3b6a commit acede2e

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

t/t5700-clone-reference.sh

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ test_cmp expected current'
5252

5353
cd "$base_dir"
5454

55-
rm -f "$U"
55+
rm -f "$U.D"
5656

5757
test_expect_success 'cloning with reference (no -l -s)' \
58-
'GIT_DEBUG_SEND_PACK=3 git clone --reference B "file://$(pwd)/A" D 3>"$U"'
58+
'GIT_DEBUG_SEND_PACK=3 git clone --reference B "file://$(pwd)/A" D 3>"$U.D"'
5959

6060
test_expect_success 'fetched no objects' \
61-
'! grep "^want" "$U"'
61+
'! grep "^want" "$U.D"'
6262

6363
cd "$base_dir"
6464

@@ -153,4 +153,32 @@ test_expect_success 'clone with reference from a tagged repository' '
153153
git clone --reference=A A I
154154
'
155155

156+
test_expect_success 'prepare branched repository' '
157+
git clone A J &&
158+
(
159+
cd J &&
160+
git checkout -b other master^ &&
161+
echo other >otherfile &&
162+
git add otherfile &&
163+
git commit -m other &&
164+
git checkout master
165+
)
166+
'
167+
168+
rm -f "$U.K"
169+
170+
test_expect_failure 'fetch with incomplete alternates' '
171+
git init K &&
172+
echo "$base_dir/A/.git/objects" >K/.git/objects/info/alternates &&
173+
(
174+
cd K &&
175+
git remote add J "file://$base_dir/J" &&
176+
GIT_DEBUG_SEND_PACK=3 git fetch J 3>"$U.K"
177+
) &&
178+
master_object=$(cd A && git for-each-ref --format="%(objectname)" refs/heads/master) &&
179+
! grep "^want $master_object" "$U.K" &&
180+
tag_object=$(cd A && git for-each-ref --format="%(objectname)" refs/tags/HEAD) &&
181+
! grep "^want $tag_object" "$U.K"
182+
'
183+
156184
test_done

0 commit comments

Comments
 (0)