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.
This commit is contained in:
Carlos Martín Nieto 2014-08-28 13:36:58 +02:00
parent e07aebb4e2
commit 05f0d0c119

View File

@ -124,9 +124,9 @@ static int ahead_behind(git_commit_list_node *one, git_commit_list_node *two,
(commit->flags & (PARENT1 | PARENT2)) == (PARENT1 | PARENT2)) (commit->flags & (PARENT1 | PARENT2)) == (PARENT1 | PARENT2))
continue; continue;
else if (commit->flags & PARENT1) else if (commit->flags & PARENT1)
(*behind)++;
else if (commit->flags & PARENT2)
(*ahead)++; (*ahead)++;
else if (commit->flags & PARENT2)
(*behind)++;
for (i = 0; i < commit->out_degree; i++) { for (i = 0; i < commit->out_degree; i++) {
git_commit_list_node *p = commit->parents[i]; git_commit_list_node *p = commit->parents[i];