Skip to content

Commit

Permalink
graph: fix ahead-behind logic
Browse files Browse the repository at this point in the history
When we see PARENT1, it means there is a local commit and thus we are
ahead. Likewise, seeing PARENT2 means that the upstream branch has a
commit and we are one more behind.

The logic is currently reversed. Correct it.

This fixes #2501.
  • Loading branch information
carlosmn committed Aug 28, 2014
1 parent e07aebb commit 05f0d0c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ static int ahead_behind(git_commit_list_node *one, git_commit_list_node *two,
(commit->flags & (PARENT1 | PARENT2)) == (PARENT1 | PARENT2))
continue;
else if (commit->flags & PARENT1)
(*behind)++;
else if (commit->flags & PARENT2)
(*ahead)++;
else if (commit->flags & PARENT2)
(*behind)++;

for (i = 0; i < commit->out_degree; i++) {
git_commit_list_node *p = commit->parents[i];
Expand Down

0 comments on commit 05f0d0c

Please sign in to comment.