summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2018-09-12 15:47:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-09-13 20:57:31 (GMT)
commite68302011c902961bc55db5eec9b9e32acd114ca (patch)
tree37d917b19f085ac99f8ada98e6a6fa2f515742e7 /t
parent8708ca09a67aeccab1d6852382cfd9267a8a395e (diff)
downloadgit-e68302011c902961bc55db5eec9b9e32acd114ca.zip
git-e68302011c902961bc55db5eec9b9e32acd114ca.tar.gz
git-e68302011c902961bc55db5eec9b9e32acd114ca.tar.bz2
fetch-object: set exact_oid when fetching
fetch_objects() currently does not set exact_oid in struct ref when invoking transport_fetch_refs(). If the server supports ref-in-want, fetch_pack() uses this field to determine whether a wanted ref should be requested as a "want-ref" line or a "want" line; without the setting of exact_oid, the wrong line will be sent. Set exact_oid, so that the correct line is sent. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t0410-partial-clone.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh
index 1281300..0ab02c3 100755
--- a/t/t0410-partial-clone.sh
+++ b/t/t0410-partial-clone.sh
@@ -170,6 +170,18 @@ test_expect_success 'fetching of missing objects' '
git verify-pack --verbose "$IDX" | grep "$HASH"
'
+test_expect_success 'fetching of missing objects works with ref-in-want enabled' '
+ # ref-in-want requires protocol version 2
+ git -C server config protocol.version 2 &&
+ git -C server config uploadpack.allowrefinwant 1 &&
+ git -C repo config protocol.version 2 &&
+
+ rm -rf repo/.git/objects/* &&
+ rm -f trace &&
+ GIT_TRACE_PACKET="$(pwd)/trace" git -C repo cat-file -p "$HASH" &&
+ grep "git< fetch=.*ref-in-want" trace
+'
+
test_expect_success 'rev-list stops traversal at missing and promised commit' '
rm -rf repo &&
test_create_repo repo &&