t4006-diff-mode.sh: use the $( ... ) construct for command substitution
[gitweb.git] / archive.c
index 7d0976fe55b8ef7b9009d080f7c1c0651a05def7..3fc0fb2928f1007ec5d8763d9d3a9b88152059ad 100644 (file)
--- a/archive.c
+++ b/archive.c
@@ -260,8 +260,8 @@ static void parse_treeish_arg(const char **argv,
        /* Remotes are only allowed to fetch actual refs */
        if (remote && !remote_allow_unreachable) {
                char *ref = NULL;
-               const char *colon = strchr(name, ':');
-               int refnamelen = colon ? colon - name : strlen(name);
+               const char *colon = strchrnul(name, ':');
+               int refnamelen = colon - name;
 
                if (!dwim_ref(name, refnamelen, sha1, &ref))
                        die("no such ref: %.*s", refnamelen, name);