@matheusbsbs / matheus-bagliano / commits / b11121d9e3
Fork 0

git-blame: show lines attributed to boundary commits differently.

When blaming with revision ranges, often many lines are attributed to different commits at the boundary, but they are not interesting for the purpose of finding project history during that revision range. This outputs the lines blamed on boundary commits differently. When showing "human format" output, their SHA-1 are shown with '^' prefixed. In "porcelain format", the commit will be shown with an extra attribute line "boundary". Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Dec 1, 2006 at 20:45 UTC b11121d9e330c40f5d089636f176d089e5bb1885
1 file changed +14 -1
builtin-blame.c
+14 -1
@@ -1090,6 +1090,11 @@ static void assign_blame(struct scoreboard *sb, struct rev_info *revs, int opt)
1090 if (!(commit->object.flags & UNINTERESTING) &&
1091 !(revs->max_age != -1 && commit->date < revs->max_age))
1092 pass_blame(sb, suspect, opt);
1093 + else {
1094 + commit->object.flags |= UNINTERESTING;
1095 + if (commit->object.parsed)
1096 + mark_parents_uninteresting(commit);
1097 + }
1098
1099 /* Take responsibility for the remaining entries */
1100 for (ent = sb->ent; ent; ent = ent->next)
@@ -1273,6 +1278,8 @@ static void emit_porcelain(struct scoreboard *sb, struct blame_entry *ent)
1278 printf("committer-tz %s\n", ci.committer_tz);
1279 printf("filename %s\n", suspect->path);
1280 printf("summary %s\n", ci.summary);
1281 + if (suspect->commit->object.flags & UNINTERESTING)
1282 + printf("boundary\n");
1283 }
1284 else if (suspect->commit->object.flags & MORE_THAN_ONE_PATH)
1285 printf("filename %s\n", suspect->path);
@@ -1308,8 +1315,14 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
1315 cp = nth_line(sb, ent->lno);
1316 for (cnt = 0; cnt < ent->num_lines; cnt++) {
1317 char ch;
1318 + int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? 40 : 8;
1319 +
1320 + if (suspect->commit->object.flags & UNINTERESTING) {
1321 + length--;
1322 + putchar('^');
1323 + }
1324
1312 - printf("%.*s", (opt & OUTPUT_LONG_OBJECT_NAME) ? 40 : 8, hex);
1325 + printf("%.*s", length, hex);
1326 if (opt & OUTPUT_ANNOTATE_COMPAT)
1327 printf("\t(%10s\t%10s\t%d)", ci.author,
1328 format_time(ci.author_time, ci.author_tz,