Commit 05f0d0c1 by Carlos Martín Nieto

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.
parent e07aebb4
...@@ -124,9 +124,9 @@ static int ahead_behind(git_commit_list_node *one, git_commit_list_node *two, ...@@ -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];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment