summaryrefslogtreecommitdiff
path: root/builtin-shortlog.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-11-25 00:01:27 -0800
committerJunio C Hamano <junkio@cox.net>2006-11-25 00:01:27 -0800
commitc95044d4f3c98b52f16e32cfe09f3ff988a80d2a (patch)
tree63ed323b6fce81b1838843c394bad79060293a9f /builtin-shortlog.c
parentac60c94d74ff3341a5175ca865fd52a0a0189146 (diff)
downloadgit-c95044d4f3c98b52f16e32cfe09f3ff988a80d2a.tar.gz
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>
Diffstat (limited to 'builtin-shortlog.c')
-rw-r--r--builtin-shortlog.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index b760b477ea..bdd952c252 100644
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
@@ -130,12 +130,17 @@ static void insert_author_oneline(struct path_list *list,
memcpy(buffer, oneline, onelinelen);
buffer[onelinelen] = '\0';
- while ((p = strstr(buffer, dot3)) != NULL) {
- memcpy(p, "...", 3);
- strcpy(p + 2, p + sizeof(dot3) - 1);
+ if (dot3) {
+ int dot3len = strlen(dot3);
+ if (dot3len > 5) {
+ while ((p = strstr(buffer, dot3)) != NULL) {
+ int taillen = strlen(p) - dot3len;
+ memcpy(p, "/.../", 5);
+ memmove(p + 5, p + dot3len, taillen + 1);
+ }
+ }
}
-
onelines = item->util;
if (onelines->nr >= onelines->alloc) {
onelines->alloc = alloc_nr(onelines->nr);