]> git.ipfire.org Git - thirdparty/git.git/commitdiff
builtin/mktree: remove hard-coded constant
authorbrian m. carlson <sandals@crustytoothpaste.net>
Mon, 15 Oct 2018 00:01:51 +0000 (00:01 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 15 Oct 2018 03:53:15 +0000 (12:53 +0900)
Instead of using a hard-coded constant for the size of a hex object ID,
switch to use the computed pointer from parse_oid_hex that points after
the parsed object ID.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/mktree.c

index 2dc4ad6ba8f227a6a8a46bac62048959220411ec..94e82b8504f7da5bed50d81771cefe3445b98ece 100644 (file)
@@ -98,7 +98,7 @@ static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_miss
 
        *ntr++ = 0; /* now at the beginning of SHA1 */
 
-       path = ntr + 41;  /* at the beginning of name */
+       path = (char *)p + 1;  /* at the beginning of name */
        if (!nul_term_line && path[0] == '"') {
                struct strbuf p_uq = STRBUF_INIT;
                if (unquote_c_style(&p_uq, path, NULL))