Skip to content

Commit 1b2be06

Browse files
committed
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
2 parents 066f6cd + 3e5e6c6 commit 1b2be06

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

fetch-pack.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,14 @@ static struct commit *deref_without_lazy_fetch(const struct object_id *oid,
137137
break;
138138
}
139139
}
140-
if (type == OBJ_COMMIT)
141-
return (struct commit *) parse_object(the_repository, oid);
140+
141+
if (type == OBJ_COMMIT) {
142+
struct commit *commit = lookup_commit(the_repository, oid);
143+
if (!commit || repo_parse_commit(the_repository, commit))
144+
return NULL;
145+
return commit;
146+
}
147+
142148
return NULL;
143149
}
144150

0 commit comments

Comments
 (0)