Merge branch 'jt/get-reference-with-commit-graph'
Micro-optimize the code that prepares commit objects to be walked by "git rev-list" when the commit-graph is available. * jt/get-reference-with-commit-graph: revision: use commit graph in get_reference()
This commit is contained in:
commit
09b2e40944
13
revision.c
13
revision.c
@ -213,7 +213,20 @@ static struct object *get_reference(struct rev_info *revs, const char *name,
|
|||||||
{
|
{
|
||||||
struct object *object;
|
struct object *object;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the repository has commit graphs, repo_parse_commit() avoids
|
||||||
|
* reading the object buffer, so use it whenever possible.
|
||||||
|
*/
|
||||||
|
if (oid_object_info(revs->repo, oid, NULL) == OBJ_COMMIT) {
|
||||||
|
struct commit *c = lookup_commit(revs->repo, oid);
|
||||||
|
if (!repo_parse_commit(revs->repo, c))
|
||||||
|
object = (struct object *) c;
|
||||||
|
else
|
||||||
|
object = NULL;
|
||||||
|
} else {
|
||||||
object = parse_object(revs->repo, oid);
|
object = parse_object(revs->repo, oid);
|
||||||
|
}
|
||||||
|
|
||||||
if (!object) {
|
if (!object) {
|
||||||
if (revs->ignore_missing)
|
if (revs->ignore_missing)
|
||||||
return object;
|
return object;
|
||||||
|
Loading…
Reference in New Issue
Block a user