Code

push: add '--prune' option
[git.git] / transport.c
index 43666394df3627a3d066f84ae529101d6e9a9f92..c20267ce4f81053e4451b3502eef5e646abaf2d2 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);
        }
 
@@ -1027,6 +1028,8 @@ int transport_push(struct transport *transport,
                        match_flags |= MATCH_REFS_ALL;
                if (flags & TRANSPORT_PUSH_MIRROR)
                        match_flags |= MATCH_REFS_MIRROR;
+               if (flags & TRANSPORT_PUSH_PRUNE)
+                       match_flags |= MATCH_REFS_PRUNE;
 
                if (match_push_refs(local_refs, &remote_refs,
                                    refspec_nr, refspec, match_flags)) {