Skip to content

Commit 2b96722

Browse files
authored
Merge pull request libgit2#4580 from pks-t/pks/diff-like-git-coalesce
blame_git: fix coalescing step never being executed
2 parents 0ad2372 + 75203d0 commit 2b96722

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/blame_git.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,8 @@ static void coalesce(git_blame *blame)
623623

624624
int git_blame__like_git(git_blame *blame, uint32_t opt)
625625
{
626+
int error = 0;
627+
626628
while (true) {
627629
git_blame__entry *ent;
628630
git_blame__origin *suspect = NULL;
@@ -632,13 +634,13 @@ int git_blame__like_git(git_blame *blame, uint32_t opt)
632634
if (!ent->guilty)
633635
suspect = ent->suspect;
634636
if (!suspect)
635-
return 0; /* all done */
637+
break;
636638

637639
/* We'll use this suspect later in the loop, so hold on to it for now. */
638640
origin_incref(suspect);
639641

640-
if (pass_blame(blame, suspect, opt) < 0)
641-
return -1;
642+
if ((error = pass_blame(blame, suspect, opt)) < 0)
643+
break;
642644

643645
/* Take responsibility for the remaining entries */
644646
for (ent = blame->ent; ent; ent = ent->next) {
@@ -652,9 +654,10 @@ int git_blame__like_git(git_blame *blame, uint32_t opt)
652654
origin_decref(suspect);
653655
}
654656

655-
coalesce(blame);
657+
if (!error)
658+
coalesce(blame);
656659

657-
return 0;
660+
return error;
658661
}
659662

660663
void git_blame__free_entry(git_blame__entry *ent)

0 commit comments

Comments
 (0)