Skip to content

Commit

Permalink
t5700: document a failure of alternates to affect fetch
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed Feb 13, 2012
1 parent b6b3b6a commit acede2e
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions t/t5700-clone-reference.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ test_cmp expected current'

cd "$base_dir"

rm -f "$U"
rm -f "$U.D"

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

test_expect_success 'fetched no objects' \
'! grep "^want" "$U"'
'! grep "^want" "$U.D"'

cd "$base_dir"

Expand Down Expand Up @@ -153,4 +153,32 @@ test_expect_success 'clone with reference from a tagged repository' '
git clone --reference=A A I
'

test_expect_success 'prepare branched repository' '
git clone A J &&
(
cd J &&
git checkout -b other master^ &&
echo other >otherfile &&
git add otherfile &&
git commit -m other &&
git checkout master
)
'

rm -f "$U.K"

test_expect_failure 'fetch with incomplete alternates' '
git init K &&
echo "$base_dir/A/.git/objects" >K/.git/objects/info/alternates &&
(
cd K &&
git remote add J "file://$base_dir/J" &&
GIT_DEBUG_SEND_PACK=3 git fetch J 3>"$U.K"
) &&
master_object=$(cd A && git for-each-ref --format="%(objectname)" refs/heads/master) &&
! grep "^want $master_object" "$U.K" &&
tag_object=$(cd A && git for-each-ref --format="%(objectname)" refs/tags/HEAD) &&
! grep "^want $tag_object" "$U.K"
'

test_done

0 comments on commit acede2e

Please sign in to comment.