Skip to content

Commit 3df27e0

Browse files
committed
Merge branch 'jt/upload-pack-v2-fix-shallow'
"git fetch" over protocol v2 into a shallow repository failed to fetch full history behind a new tip of history that was diverged before the cut-off point of the history that was previously fetched shallowly. * jt/upload-pack-v2-fix-shallow: upload-pack: clear flags before each v2 request upload-pack: make want_obj not global upload-pack: make have_obj not global
2 parents 3fc8522 + d1035ca commit 3df27e0

File tree

2 files changed

+115
-63
lines changed

2 files changed

+115
-63
lines changed

t/t5702-protocol-v2.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,31 @@ test_expect_success 'fetch supports include-tag and tag following' '
446446
git -C client cat-file -e $(git -C client rev-parse annotated_tag)
447447
'
448448

449+
test_expect_success 'upload-pack respects client shallows' '
450+
rm -rf server client trace &&
451+
452+
git init server &&
453+
test_commit -C server base &&
454+
test_commit -C server client_has &&
455+
456+
git clone --depth=1 "file://$(pwd)/server" client &&
457+
458+
# Add extra commits to the client so that the whole fetch takes more
459+
# than 1 request (due to negotiation)
460+
for i in $(test_seq 1 32)
461+
do
462+
test_commit -C client c$i
463+
done &&
464+
465+
git -C server checkout -b newbranch base &&
466+
test_commit -C server client_wants &&
467+
468+
GIT_TRACE_PACKET="$(pwd)/trace" git -C client -c protocol.version=2 \
469+
fetch origin newbranch &&
470+
# Ensure that protocol v2 is used
471+
grep "fetch< version 2" trace
472+
'
473+
449474
# Test protocol v2 with 'http://' transport
450475
#
451476
. "$TEST_DIRECTORY"/lib-httpd.sh

0 commit comments

Comments
 (0)