Browse Source

Don't parse commit objects more than once.

Yes, the "parse_commit()" already checks for this condition, but
we need to check for it in rev-tree too, so that we don't start
walking the parent chain unnecessarily.
maint
Linus Torvalds 20 years ago
parent
commit
3b7d368f34
  1. 4
      rev-tree.c

4
rev-tree.c

@ -55,6 +55,10 @@ void process_commit(unsigned char *sha1)
{ {
struct commit_list *parents; struct commit_list *parents;
struct commit *obj = lookup_commit(sha1); struct commit *obj = lookup_commit(sha1);

if (obj->object.parsed)
return;

parse_commit(obj); parse_commit(obj);
parents = obj->parents; parents = obj->parents;

Loading…
Cancel
Save