aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-02-11 12:29:08 -0800
committerJunio C Hamano <gitster@pobox.com>2026-02-11 12:29:08 -0800
commit06cef761b1067c6debb7dc946f2c4f202fd60083 (patch)
tree1b5cbcbce1c28db8c61c8cace8e343d97c0de653 /builtin
parentea03b35bb59b73f00180c88d9875ffeb72f41adc (diff)
parentd519082d4ebf998cd9d10a5ef33544a479e7699c (diff)
downloadgit-06cef761b1067c6debb7dc946f2c4f202fd60083.tar.xz
Merge branch 'rs/blame-ignore-colors-fix'
"git blame --ignore-revs=... --color-lines" did not account for ignored revisions passing blame to the same commit an adjacent line gets blamed for. * rs/blame-ignore-colors-fix: blame: fix coloring for repeated suspects
Diffstat (limited to 'builtin')
-rw-r--r--builtin/blame.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/builtin/blame.c b/builtin/blame.c
index 6044973462..bb460346e6 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -454,7 +454,8 @@ static void determine_line_heat(struct commit_info *ci, const char **dest_color)
*dest_color = colorfield[i].col;
}
-static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int opt)
+static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent,
+ int opt, struct blame_entry *prev_ent)
{
int cnt;
const char *cp;
@@ -485,7 +486,10 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int
the_hash_algo->hexsz : (size_t) abbrev;
if (opt & OUTPUT_COLOR_LINE) {
- if (cnt > 0) {
+ if (cnt > 0 ||
+ (prev_ent &&
+ oideq(&suspect->commit->object.oid,
+ &prev_ent->suspect->commit->object.oid))) {
color = repeated_meta_color;
reset = GIT_COLOR_RESET;
} else {
@@ -571,7 +575,7 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int
static void output(struct blame_scoreboard *sb, int option)
{
- struct blame_entry *ent;
+ struct blame_entry *ent, *prev_ent = NULL;
if (option & OUTPUT_PORCELAIN) {
for (ent = sb->ent; ent; ent = ent->next) {
@@ -593,7 +597,8 @@ static void output(struct blame_scoreboard *sb, int option)
if (option & OUTPUT_PORCELAIN)
emit_porcelain(sb, ent, option);
else {
- emit_other(sb, ent, option);
+ emit_other(sb, ent, option, prev_ent);
+ prev_ent = ent;
}
}
}