diff options
-rw-r--r-- | fetch-object.c | 1 | ||||
-rwxr-xr-x | t/t0410-partial-clone.sh | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/fetch-object.c b/fetch-object.c index 1af1bf857a..4266548800 100644 --- a/fetch-object.c +++ b/fetch-object.c @@ -32,6 +32,7 @@ void fetch_objects(const char *remote_name, const struct object_id *oids, for (i = 0; i < oid_nr; i++) { struct ref *new_ref = alloc_ref(oid_to_hex(&oids[i])); oidcpy(&new_ref->old_oid, &oids[i]); + new_ref->exact_oid = 1; new_ref->next = ref; ref = new_ref; } diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh index 1281300664..0ab02c337d 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 && |