Unverified Commit 2b967226 by Edward Thomson Committed by GitHub

Merge pull request #4580 from pks-t/pks/diff-like-git-coalesce

blame_git: fix coalescing step never being executed
parents 0ad2372b 75203d03
...@@ -623,6 +623,8 @@ static void coalesce(git_blame *blame) ...@@ -623,6 +623,8 @@ static void coalesce(git_blame *blame)
int git_blame__like_git(git_blame *blame, uint32_t opt) int git_blame__like_git(git_blame *blame, uint32_t opt)
{ {
int error = 0;
while (true) { while (true) {
git_blame__entry *ent; git_blame__entry *ent;
git_blame__origin *suspect = NULL; git_blame__origin *suspect = NULL;
...@@ -632,13 +634,13 @@ int git_blame__like_git(git_blame *blame, uint32_t opt) ...@@ -632,13 +634,13 @@ int git_blame__like_git(git_blame *blame, uint32_t opt)
if (!ent->guilty) if (!ent->guilty)
suspect = ent->suspect; suspect = ent->suspect;
if (!suspect) if (!suspect)
return 0; /* all done */ break;
/* We'll use this suspect later in the loop, so hold on to it for now. */ /* We'll use this suspect later in the loop, so hold on to it for now. */
origin_incref(suspect); origin_incref(suspect);
if (pass_blame(blame, suspect, opt) < 0) if ((error = pass_blame(blame, suspect, opt)) < 0)
return -1; break;
/* Take responsibility for the remaining entries */ /* Take responsibility for the remaining entries */
for (ent = blame->ent; ent; ent = ent->next) { for (ent = blame->ent; ent; ent = ent->next) {
...@@ -652,9 +654,10 @@ int git_blame__like_git(git_blame *blame, uint32_t opt) ...@@ -652,9 +654,10 @@ int git_blame__like_git(git_blame *blame, uint32_t opt)
origin_decref(suspect); origin_decref(suspect);
} }
coalesce(blame); if (!error)
coalesce(blame);
return 0; return error;
} }
void git_blame__free_entry(git_blame__entry *ent) void git_blame__free_entry(git_blame__entry *ent)
......
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