graph: fix ahead-behind logic 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.
diff --git a/src/graph.c b/src/graph.c
index 1c264d9..8accd80 100644
--- a/src/graph.c
+++ b/src/graph.c
@@ -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];