Skip to content

Commit

Permalink
assume parse_commit checks commit->object.parsed
Browse files Browse the repository at this point in the history
The parse_commit function will check the "parsed" flag of
the object and do nothing if it is set. There is no need
for callers to check the flag themselves, and doing so only
clutters the code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Oct 24, 2013
1 parent 7059dcc commit 0064053
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
3 changes: 1 addition & 2 deletions builtin/blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -1554,8 +1554,7 @@ static void assign_blame(struct scoreboard *sb, int opt)
*/
origin_incref(suspect);
commit = suspect->commit;
if (!commit->object.parsed)
parse_commit(commit);
parse_commit(commit);
if (reverse ||
(!(commit->object.flags & UNINTERESTING) &&
!(revs->max_age != -1 && commit->date < revs->max_age)))
Expand Down
3 changes: 1 addition & 2 deletions builtin/name-rev.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ static void name_rev(struct commit *commit,
struct commit_list *parents;
int parent_number = 1;

if (!commit->object.parsed)
parse_commit(commit);
parse_commit(commit);

if (commit->date < cutoff)
return;
Expand Down
3 changes: 1 addition & 2 deletions builtin/show-branch.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ static void join_revs(struct commit_list **list_p,
parents = parents->next;
if ((this_flag & flags) == flags)
continue;
if (!p->object.parsed)
parse_commit(p);
parse_commit(p);
if (mark_seen(p, seen_p) && !still_interesting)
extra--;
p->object.flags |= flags;
Expand Down
8 changes: 3 additions & 5 deletions fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ static void rev_list_push(struct commit *commit, int mark)
if (!(commit->object.flags & mark)) {
commit->object.flags |= mark;

if (!(commit->object.parsed))
if (parse_commit(commit))
return;
if (parse_commit(commit))
return;

prio_queue_put(&rev_list, commit);

Expand Down Expand Up @@ -127,8 +126,7 @@ static const unsigned char *get_rev(void)
return NULL;

commit = prio_queue_get(&rev_list);
if (!commit->object.parsed)
parse_commit(commit);
parse_commit(commit);
parents = commit->parents;

commit->object.flags |= POPPED;
Expand Down

0 comments on commit 0064053

Please sign in to comment.