Skip to content

Commit ebbed3b

Browse files
derrickstoleegitster
authored andcommitted
revision.c: reduce object database queries
In mark_parents_uninteresting(), we check for the existence of an object file to see if we should treat a commit as parsed. The result is to set the "parsed" bit on the commit. Modify the condition to only check has_object_file() if the result would change the parsed bit. When a local branch is different from its upstream ref, "git status" will compute ahead/behind counts. This uses paint_down_to_common() and hits mark_parents_uninteresting(). On a copy of the Linux repo with a local instance of "master" behind the remote branch "origin/master" by ~60,000 commits, we find the performance of "git status" went from 1.42 seconds to 1.32 seconds, for a relative difference of -7.0%. Signed-off-by: Derrick Stolee <[email protected]> Reviewed-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9752ad0 commit ebbed3b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

revision.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ void mark_parents_uninteresting(struct commit *commit)
110110
* it is popped next time around, we won't be trying
111111
* to parse it and get an error.
112112
*/
113-
if (!has_object_file(&commit->object.oid))
113+
if (!commit->object.parsed &&
114+
!has_object_file(&commit->object.oid))
114115
commit->object.parsed = 1;
115116

116117
if (commit->object.flags & UNINTERESTING)

0 commit comments

Comments
 (0)