summaryrefslogtreecommitdiff
path: root/builtin-push.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-10-16 00:25:34 -0400
committerShawn O. Pearce <spearce@spearce.org>2007-10-16 00:25:56 -0400
commit18184f79dbf70e157399ba2288f7045582fd61c6 (patch)
treeb2a218a177899273fc216eba9d1a0fd6f0f51656 /builtin-push.c
parent2e13e5d89252ceef606a0a7be32dbf5bea7e5aca (diff)
downloadgit-18184f79dbf70e157399ba2288f7045582fd61c6.tar.gz
Fix 'push --all branch...' error handling
The builtin-fetch topic changed push's handling of --all to setting the new TRANSPORT_PUSH_ALL flag before starting the push subroutine for the given transport. Unfortunately not all references within builtin-push were changed to test this flag therefore allowing push to incorrectly accept refspecs and --all. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'builtin-push.c')
-rw-r--r--builtin-push.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/builtin-push.c b/builtin-push.c
index a552f0dac6..4b39ef3852 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -10,7 +10,7 @@
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;
}
@@ -138,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);