summaryrefslogtreecommitdiff
path: root/src/graph.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-08-28 13:36:58 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-08-28 13:36:58 +0200
commit05f0d0c1190f0a3922d48d9f35c6ef6f3c2048a7 (patch)
treeb061ac725aa71105608aecc15f7ab23c2f9dd03b /src/graph.c
parente07aebb4e2b6ab544153c294914118ae2f2f512c (diff)
downloadlibgit2-05f0d0c1190f0a3922d48d9f35c6ef6f3c2048a7.tar.gz
graph: fix ahead-behind logiccmn/ahead-behind-order
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.
Diffstat (limited to 'src/graph.c')
-rw-r--r--src/graph.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/graph.c b/src/graph.c
index 1c264d997..8accd808c 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];