]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-push.c
Merge branch 'maint'
[git.git] / builtin-push.c
index 4ee36c292d9d42f658673c5d37d80077d65dc855..4b39ef3852a5dcb9b099527d4aafc33ba3bb6da1 100644 (file)
@@ -8,9 +8,9 @@
 #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 int thin, verbose;
 static const char *receivepack;
 
 static const char **refspec;
@@ -52,7 +52,9 @@ static int do_push(const char *repo, int flags)
        if (!remote)
                die("bad repository '%s'", repo);
 
-       if (!refspec && !all && remote->push_refspec_nr) {
+       if (!refspec
+               && !(flags & TRANSPORT_PUSH_ALL)
+               && remote->push_refspec_nr) {
                refspec = remote->push_refspec;
                refspec_nr = remote->push_refspec_nr;
        }
@@ -107,6 +109,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;
@@ -134,7 +140,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
                usage(push_usage);
        }
        set_refspecs(argv + i, argc - i);
-       if (all && refspec)
+       if ((flags & TRANSPORT_PUSH_ALL) && refspec)
                usage(push_usage);
 
        return do_push(repo, flags);