提交 f7122265 编写于 作者: J Jonas Fonseca 提交者: Junio C Hamano

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

Signed-off-by: NJonas Fonseca <fonseca@diku.dk>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 0ea4d4c9
......@@ -42,7 +42,7 @@ static void add_to_known_names(const char *path,
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册