git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] git-shortlog: fix common repository prefix abbreviation.

From
Junio C Hamano <junkio@cox.net>
Date
Nov 25, 2006, 08:10 UTC
Message-ID
<7vfyc854ku.fsf@assigned-by-dhcp.cox.net>

The code to abbreviate the common repository prefix was totally borked.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 builtin-shortlog.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index b760b47..bdd952c 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);
-- 
1.4.4.1.g61fba
Message 1 of 1 in “git-shortlog: fix common repository prefix abbreviation.”
  1. 1/2 git-shortlog: fix common repository prefix abbreviation.Junio C Hamano, Nov 25, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.