Skip to content

Commit ab3bb80

Browse files
author
Junio C Hamano
committed
git blame -C: fix output format tweaks when crossing file boundary.
We used to get the case that more than two paths came from the same commit wrong when computing the output width and deciding to turn on --show-name option automatically. When we find that lines that came from a path that is different from what we started digging from, we should always turn --show-name on, and we should count the name length for all files involved. Signed-off-by: Junio C Hamano <[email protected]>
1 parent f73da29 commit ab3bb80

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

builtin-blame.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,14 +1435,14 @@ static void find_alignment(struct scoreboard *sb, int *option)
14351435
struct commit_info ci;
14361436
int num;
14371437

1438+
if (strcmp(suspect->path, sb->path))
1439+
*option |= OUTPUT_SHOW_NAME;
1440+
num = strlen(suspect->path);
1441+
if (longest_file < num)
1442+
longest_file = num;
14381443
if (!(suspect->commit->object.flags & METAINFO_SHOWN)) {
14391444
suspect->commit->object.flags |= METAINFO_SHOWN;
14401445
get_commit_info(suspect->commit, &ci, 1);
1441-
if (strcmp(suspect->path, sb->path))
1442-
*option |= OUTPUT_SHOW_NAME;
1443-
num = strlen(suspect->path);
1444-
if (longest_file < num)
1445-
longest_file = num;
14461446
num = strlen(ci.author);
14471447
if (longest_author < num)
14481448
longest_author = num;

0 commit comments

Comments
 (0)