Jeff King <peff@xxxxxxxx> writes: > diff --git a/blame.c b/blame.c > index 82fa16d658..1be1cd82a2 100644 > --- a/blame.c > +++ b/blame.c > @@ -1184,6 +1184,7 @@ void blame_coalesce(struct blame_scoreboard *sb) > for (ent = sb->ent; ent && (next = ent->next); ent = next) { > if (ent->suspect == next->suspect && > ent->s_lno + ent->num_lines == next->s_lno && > + ent->lno + ent->num_lines == next->lno && > ent->ignored == next->ignored && > ent->unblamable == next->unblamable) { > ent->num_lines += next->num_lines; When laid out like this, the correctness of the fix is quite obvious and it is surprising that this bug has survived for all these years, as it dates back to cee7f245 (git-pickaxe: blame rewritten., 2006-10-19), the inception of the current "git blame". Thanks. > diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh > index 7f39a84289..ba8013b002 100755 > --- a/t/t8003-blame-corner-cases.sh > +++ b/t/t8003-blame-corner-cases.sh > @@ -310,4 +310,13 @@ test_expect_success 'blame coalesce' ' > test_cmp expect actual > ' > > +test_expect_success 'blame does not coalesce non-adjacent result lines' ' > + cat >expect <<-EOF && > + $orig 1) ABC > + $orig 3) DEF > + EOF > + git blame --no-abbrev -s -L1,1 -L3,3 $split giraffe >actual && > + test_cmp expect actual > +' > + > test_done