From: Junio C Hamano Date: Wed, 29 Nov 2006 06:29:18 +0000 (-0800) Subject: git blame -C: fix output format tweaks when crossing file boundary. X-Git-Tag: v1.4.4.2~8 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ab3bb800b46cf66249ead9e13c22cbc48d790c9a;p=git.git 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 --- diff --git a/builtin-blame.c b/builtin-blame.c index 066dee743..53fed4501 100644 --- a/builtin-blame.c +++ b/builtin-blame.c @@ -1435,14 +1435,14 @@ static void find_alignment(struct scoreboard *sb, int *option) struct commit_info ci; int num; + if (strcmp(suspect->path, sb->path)) + *option |= OUTPUT_SHOW_NAME; + num = strlen(suspect->path); + if (longest_file < num) + longest_file = num; if (!(suspect->commit->object.flags & METAINFO_SHOWN)) { suspect->commit->object.flags |= METAINFO_SHOWN; get_commit_info(suspect->commit, &ci, 1); - if (strcmp(suspect->path, sb->path)) - *option |= OUTPUT_SHOW_NAME; - num = strlen(suspect->path); - if (longest_file < num) - longest_file = num; num = strlen(ci.author); if (longest_author < num) longest_author = num;