summaryrefslogtreecommitdiff
path: root/fetch-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-08-24 15:32:41 -0700
committerJunio C Hamano <gitster@pobox.com>2021-08-24 15:32:41 -0700
commit1b2be06e04c5dba2fc25d2eb0cc2bd85d469e350 (patch)
tree291b4500a945accc7ac96225f87bf685e3aac87e /fetch-pack.c
parent066f6cd44707ca2f8c3dc2a2ae02c2c9784903bf (diff)
parent3e5e6c6e94f09973d3a72049aad09fd2131a3648 (diff)
downloadgit-1b2be06e04c5dba2fc25d2eb0cc2bd85d469e350.tar.gz
Merge branch 'ps/fetch-pack-load-refs-optim'
Loading of ref tips to prepare for common ancestry negotiation in "git fetch-pack" has been optimized by taking advantage of the commit graph when available. * ps/fetch-pack-load-refs-optim: fetch-pack: speed up loading of refs via commit graph
Diffstat (limited to 'fetch-pack.c')
-rw-r--r--fetch-pack.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index b0c7be717c..0bf7ed7e47 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -137,8 +137,14 @@ static struct commit *deref_without_lazy_fetch(const struct object_id *oid,
break;
}
}
- if (type == OBJ_COMMIT)
- return (struct commit *) parse_object(the_repository, oid);
+
+ if (type == OBJ_COMMIT) {
+ struct commit *commit = lookup_commit(the_repository, oid);
+ if (!commit || repo_parse_commit(the_repository, commit))
+ return NULL;
+ return commit;
+ }
+
return NULL;
}