Code

Merge branch 'master' into db/fetch-pack
[git.git] / builtin-push.c
index 7d7e826a39707cbd81d346b7eef1e625bee4b417..a552f0dac654bb532ecd43ec5c8cd15e113ef82c 100644 (file)
@@ -8,7 +8,7 @@
 #include "remote.h"
 #include "transport.h"
 
-static const char push_usage[] = "git-push [--all] [--tags] [--receive-pack=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]";
+static const char push_usage[] = "git-push [--all] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]";
 
 static int all, thin, verbose;
 static const char *receivepack;
@@ -57,9 +57,9 @@ static int do_push(const char *repo, int flags)
                refspec_nr = remote->push_refspec_nr;
        }
        errs = 0;
-       for (i = 0; i < remote->uri_nr; i++) {
+       for (i = 0; i < remote->url_nr; i++) {
                struct transport *transport =
-                       transport_get(remote, remote->uri[i]);
+                       transport_get(remote, remote->url[i]);
                int err;
                if (receivepack)
                        transport_set_option(transport,
@@ -68,14 +68,14 @@ static int do_push(const char *repo, int flags)
                        transport_set_option(transport, TRANS_OPT_THIN, "yes");
 
                if (verbose)
-                       fprintf(stderr, "Pushing to %s\n", remote->uri[i]);
+                       fprintf(stderr, "Pushing to %s\n", remote->url[i]);
                err = transport_push(transport, refspec_nr, refspec, flags);
                err |= transport_disconnect(transport);
 
                if (!err)
                        continue;
 
-               error("failed to push to '%s'", remote->uri[i]);
+               error("failed to push to '%s'", remote->url[i]);
                errs++;
        }
        return !!errs;
@@ -107,6 +107,10 @@ int cmd_push(int argc, const char **argv, const char *prefix)
                        flags |= TRANSPORT_PUSH_ALL;
                        continue;
                }
+               if (!strcmp(arg, "--dry-run")) {
+                       flags |= TRANSPORT_PUSH_DRY_RUN;
+                       continue;
+               }
                if (!strcmp(arg, "--tags")) {
                        add_refspec("refs/tags/*");
                        continue;