mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-06 15:29:22 +00:00
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:
parent
e07aebb4e2
commit
05f0d0c119
@ -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];
|
||||||
|
Loading…
Reference in New Issue
Block a user