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 <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Feb 11, 2012 at 07:20 UTC acede2ebc939f312058ab7aa15e9ede71029ee85
1 file changed +31 -3
t/t5700-clone-reference.sh
+31 -3
@@ -52,13 +52,13 @@ test_cmp expected current'
52
53 cd "$base_dir"
54
55 -rm -f "$U"
55 +rm -f "$U.D"
56
57 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"'
59
60 test_expect_success 'fetched no objects' \
61 -'! grep "^want" "$U"'
61 +'! grep "^want" "$U.D"'
62
63 cd "$base_dir"
64
@@ -153,4 +153,32 @@ test_expect_success 'clone with reference from a tagged repository' '
153 git clone --reference=A A I
154 '
155
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 +
184 test_done