Skip to content

Commit

Permalink
blame: micro-optimize cmp_suspect()
Browse files Browse the repository at this point in the history
The commit structures are guaranteed their uniqueness by the object
layer, so we can check their address and see if they are the same
without going down to the object sha1 level.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Mar 20, 2007
1 parent 567fb65 commit 57584d9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions builtin-blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,8 @@ struct scoreboard {

static int cmp_suspect(struct origin *a, struct origin *b)
{
int cmp = hashcmp(a->commit->object.sha1, b->commit->object.sha1);
if (cmp)
return cmp;
if (a->commit != b->commit)
return 1;
return strcmp(a->path, b->path);
}

Expand Down

0 comments on commit 57584d9

Please sign in to comment.