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 <junkio@cox.net>
Junio C Hamano committed
Nov 28, 2006 at 22:29 UTC
ab3bb800b46cf66249ead9e13c22cbc48d790c9a
1 file changed
+5
-5
builtin-blame.c
+5
-5
@@ -1435,14 +1435,14 @@ static void find_alignment(struct scoreboard *sb, int *option)
1435
struct commit_info ci;
1436
int num;
1437
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;
1443
if (!(suspect->commit->object.flags & METAINFO_SHOWN)) {
1444
suspect->commit->object.flags |= METAINFO_SHOWN;
1445
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;
1446
num = strlen(ci.author);
1447
if (longest_author < num)
1448
longest_author = num;