git-shortlog: fix common repository prefix abbreviation.
The code to abbreviate the common repository prefix was totally borked. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Nov 25, 2006 at 00:01 UTC
c95044d4f3c98b52f16e32cfe09f3ff988a80d2a
1 file changed
+9
-4
builtin-shortlog.c
+9
-4
@@ -130,12 +130,17 @@ static void insert_author_oneline(struct path_list *list,
130
memcpy(buffer, oneline, onelinelen);
131
buffer[onelinelen] = '\0';
132
133
- while ((p = strstr(buffer, dot3)) != NULL) {
134
- memcpy(p, "...", 3);
135
- strcpy(p + 2, p + sizeof(dot3) - 1);
133
+ if (dot3) {
134
+ int dot3len = strlen(dot3);
135
+ if (dot3len > 5) {
136
+ while ((p = strstr(buffer, dot3)) != NULL) {
137
+ int taillen = strlen(p) - dot3len;
138
+ memcpy(p, "/.../", 5);
139
+ memmove(p + 5, p + dot3len, taillen + 1);
140
+ }
141
+ }
142
}
143
138
-
144
onelines = item->util;
145
if (onelines->nr >= onelines->alloc) {
146
onelines->alloc = alloc_nr(onelines->nr);