Code

remote: refactor code into alloc_delete_ref()
[git.git] / transport.c
index 43666394df3627a3d066f84ae529101d6e9a9f92..cac0c065ff9f82011b204f932932283b01a5d034 100644 (file)
@@ -474,8 +474,12 @@ static int set_git_option(struct git_transport_options *opts,
        } else if (!strcmp(name, TRANS_OPT_DEPTH)) {
                if (!value)
                        opts->depth = 0;
-               else
-                       opts->depth = atoi(value);
+               else {
+                       char *end;
+                       opts->depth = strtol(value, &end, 0);
+                       if (*end)
+                               die("transport: invalid depth option '%s'", value);
+               }
                return 0;
        }
        return 1;
@@ -895,10 +899,8 @@ struct transport *transport_get(struct remote *remote, const char *url)
 
                while (is_urlschemechar(p == url, *p))
                        p++;
-               if (!prefixcmp(p, "::")) {
+               if (!prefixcmp(p, "::"))
                        helper = xstrndup(url, p - url);
-                       remote->foreign_vcs = helper;
-               }
        }
 
        if (helper) {
@@ -940,7 +942,6 @@ struct transport *transport_get(struct remote *remote, const char *url)
                char *handler = xmalloc(len + 1);
                handler[len] = 0;
                strncpy(handler, url, len);
-               remote->foreign_vcs = handler;
                transport_helper_init(ret, handler);
        }