summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: df076bd)
raw | patch | inline | side by side (parent: df076bd)
author | Linus Torvalds <torvalds@osdl.org> | |
Fri, 29 Jul 2005 03:37:23 +0000 (20:37 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Fri, 29 Jul 2005 04:05:06 +0000 (21:05 -0700) |
When git-apply was printing out long filenames, it used to just truncate
them to show the last "max_len" characters of the filename. Which can be
really quite ugly (note the two filenames that have just been silently
truncated from the beginning - it looks even worse when there are lots
of them, like there were in the current v2.6.13-rc4 cris arch update):
Documentation/video4linux/README.saa7134 | 9
Documentation/video4linux/bttv/Cards | 74
umentation/video4linux/hauppauge-wintv-cx88-ir.txt | 54
Documentation/video4linux/lifeview.txt | 42
mentation/video4linux/not-in-cx2388x-datasheet.txt | 41
Documentation/w1/w1.generic | 107
With this patch it now looks like so:
Documentation/video4linux/README.saa7134 | 9
Documentation/video4linux/bttv/Cards | 74
.../video4linux/hauppauge-wintv-cx88-ir.txt | 54
Documentation/video4linux/lifeview.txt | 42
.../video4linux/not-in-cx2388x-datasheet.txt | 41
Documentation/w1/w1.generic | 107
ie we've made it clear with an ellipsis that we've cut off something from
the beginning, and it also tries to do it cleanly at a subdirectory level.
Signed-off-by: Linus "good taste" Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
them to show the last "max_len" characters of the filename. Which can be
really quite ugly (note the two filenames that have just been silently
truncated from the beginning - it looks even worse when there are lots
of them, like there were in the current v2.6.13-rc4 cris arch update):
Documentation/video4linux/README.saa7134 | 9
Documentation/video4linux/bttv/Cards | 74
umentation/video4linux/hauppauge-wintv-cx88-ir.txt | 54
Documentation/video4linux/lifeview.txt | 42
mentation/video4linux/not-in-cx2388x-datasheet.txt | 41
Documentation/w1/w1.generic | 107
With this patch it now looks like so:
Documentation/video4linux/README.saa7134 | 9
Documentation/video4linux/bttv/Cards | 74
.../video4linux/hauppauge-wintv-cx88-ir.txt | 54
Documentation/video4linux/lifeview.txt | 42
.../video4linux/not-in-cx2388x-datasheet.txt | 41
Documentation/w1/w1.generic | 107
ie we've made it clear with an ellipsis that we've cut off something from
the beginning, and it also tries to do it cleanly at a subdirectory level.
Signed-off-by: Linus "good taste" Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
apply.c | patch | blob | history |
index 630d6bc463fd49a1954f9123575f52b96eb0555d..c671d9e86cc04e2c6756212e3496c4ef5db8207a 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -737,6 +737,7 @@ static const char minuses[]= "--------------------------------------------------
static void show_stats(struct patch *patch)
{
+ const char *prefix = "";
char *name = patch->new_name;
int len, max, add, del, total;
max = max_len;
if (max > 50)
max = 50;
- if (len > max)
+ if (len > max) {
+ char *slash;
+ prefix = "...";
+ max -= 3;
name += len - max;
+ slash = strchr(name, '/');
+ if (slash)
+ name = slash;
+ }
len = max;
/*
add = (add * max + max_change / 2) / max_change;
del = total - add;
}
- printf(" %-*s |%5d %.*s%.*s\n",
+ printf(" %s%-*s |%5d %.*s%.*s\n", prefix,
len, name, patch->lines_added + patch->lines_deleted,
add, pluses, del, minuses);
}