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

[PATCH] describe: fix off-by-one error in --abbrev=40 handling

From
Jonas Fonseca <fonseca@diku.dk>
Date
Aug 25, 2006, 00:48 UTC
Message-ID
<20060825004804.GA4069@diku.dk>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---

Possible stupid fix, but shouldn't one be able to say --abbrev=40 if only once in a life time?

 describe.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/describe.c b/describe.c
index 2b9301f..5dd8b2e 100644
--- a/describe.c
+++ b/describe.c
@@ -42,7 +42,7 @@ static void add_to_known_names(const cha
 	struct commit_name *name = xmalloc(sizeof(struct commit_name) + len);
 
 	name->commit = commit;
-	name->prio = prio; 
+	name->prio = prio;
 	memcpy(name->path, path, len);
 	idx = names;
 	if (idx >= allocs) {
@@ -154,7 +154,7 @@ int main(int argc, char **argv)
 			tags = 1;
 		else if (!strncmp(arg, "--abbrev=", 9)) {
 			abbrev = strtoul(arg + 9, NULL, 10);
-			if (abbrev < MINIMUM_ABBREV || 40 <= abbrev)
+			if (abbrev < MINIMUM_ABBREV || 40 < abbrev)
 				abbrev = DEFAULT_ABBREV;
 		}
 		else
-- 
Jonas Fonseca
Message 1 of 1 in “describe: fix off-by-one error in --abbrev=40 handling”
  1. describe: fix off-by-one error in --abbrev=40 handlingJonas Fonseca, Aug 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.