summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2018-04-22 14:43:18 +0100
committerGitHub <noreply@github.com>2018-04-22 14:43:18 +0100
commit2b9672267bace95bae56a558491edf0637f819ba (patch)
tree171b3ec60ce75a1b9b4e75935eb82324689cf266
parent0ad2372b4309f511c48c8e293f1eec396468595a (diff)
parent75203d035d8bf87f7b9c8f0b4fda7766894b5de2 (diff)
downloadlibgit2-2b9672267bace95bae56a558491edf0637f819ba.tar.gz
Merge pull request #4580 from pks-t/pks/diff-like-git-coalesce
blame_git: fix coalescing step never being executed
-rw-r--r--src/blame_git.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/blame_git.c b/src/blame_git.c
index 3c221b318..302cd1e23 100644
--- a/src/blame_git.c
+++ b/src/blame_git.c
@@ -623,6 +623,8 @@ static void coalesce(git_blame *blame)
int git_blame__like_git(git_blame *blame, uint32_t opt)
{
+ int error = 0;
+
while (true) {
git_blame__entry *ent;
git_blame__origin *suspect = NULL;
@@ -632,13 +634,13 @@ int git_blame__like_git(git_blame *blame, uint32_t opt)
if (!ent->guilty)
suspect = ent->suspect;
if (!suspect)
- return 0; /* all done */
+ break;
/* We'll use this suspect later in the loop, so hold on to it for now. */
origin_incref(suspect);
- if (pass_blame(blame, suspect, opt) < 0)
- return -1;
+ if ((error = pass_blame(blame, suspect, opt)) < 0)
+ break;
/* Take responsibility for the remaining entries */
for (ent = blame->ent; ent; ent = ent->next) {
@@ -652,9 +654,10 @@ int git_blame__like_git(git_blame *blame, uint32_t opt)
origin_decref(suspect);
}
- coalesce(blame);
+ if (!error)
+ coalesce(blame);
- return 0;
+ return error;
}
void git_blame__free_entry(git_blame__entry *ent)