summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/blame.c1
-rw-r--r--src/blame_git.c15
-rw-r--r--src/blame_git.h4
3 files changed, 17 insertions, 3 deletions
diff --git a/src/blame.c b/src/blame.c
index a4ac84fde..b7886aa5c 100644
--- a/src/blame.c
+++ b/src/blame.c
@@ -247,6 +247,7 @@ static git_blame_hunk* hunk_from_entry(struct blame_entry *e)
git_blame_hunk *h = new_hunk(
e->lno+1, e->num_lines, e->s_lno+1, e->suspect->path);
git_oid_cpy(&h->final_commit_id, git_commit_id(e->suspect->commit));
+ h->boundary = e->is_boundary ? 1 : 0;
return h;
}
diff --git a/src/blame_git.c b/src/blame_git.c
index bff36c50c..02628c4ba 100644
--- a/src/blame_git.c
+++ b/src/blame_git.c
@@ -456,8 +456,12 @@ static void pass_blame(struct scoreboard *sb, struct origin *origin, uint32_t op
GIT_UNUSED(opt);
num_sg = git_commit_parentcount(commit);
- if (!num_sg)
+ if (!git_oid_cmp(git_commit_id(commit), &sb->blame->options.oldest_commit))
+ num_sg = 0;
+ if (!num_sg) {
+ git_oid_cpy(&sb->blame->options.oldest_commit, git_commit_id(commit));
goto finish;
+ }
else if (num_sg < (int)ARRAY_SIZE(sg_buf))
memset(sg_buf, 0, sizeof(sg_buf));
else
@@ -558,9 +562,14 @@ void assign_blame(struct scoreboard *sb, uint32_t opt)
pass_blame(sb, suspect, opt);
/* Take responsibility for the remaining entries */
- for (ent = sb->ent; ent; ent = ent->next)
- if (same_suspect(ent->suspect, suspect))
+ for (ent = sb->ent; ent; ent = ent->next) {
+ if (same_suspect(ent->suspect, suspect)) {
ent->guilty = 1;
+ ent->is_boundary = !git_oid_cmp(
+ git_commit_id(suspect->commit),
+ &sb->blame->options.oldest_commit);
+ }
+ }
origin_decref(suspect);
}
}
diff --git a/src/blame_git.h b/src/blame_git.h
index 89ebc3228..6af804db2 100644
--- a/src/blame_git.h
+++ b/src/blame_git.h
@@ -55,6 +55,10 @@ struct blame_entry {
* scanning the lines over and over.
*/
unsigned score;
+
+ /* Whether this entry has been tracked to a boundary commit.
+ */
+ bool is_boundary;
};
/*