@matheusbsbs / matheus-bagliano / commits / 18184f79db
Fork 0

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>

Shawn O. Pearce committed Oct 16, 2007 at 00:25 UTC 18184f79dbf70e157399ba2288f7045582fd61c6
1 file changed +5 -3
builtin-push.c
+5 -3
@@ -10,7 +10,7 @@
10
11 static const char push_usage[] = "git-push [--all] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]";
12
13 -static int all, thin, verbose;
13 +static int thin, verbose;
14 static const char *receivepack;
15
16 static const char **refspec;
@@ -52,7 +52,9 @@ static int do_push(const char *repo, int flags)
52 if (!remote)
53 die("bad repository '%s'", repo);
54
55 - if (!refspec && !all && remote->push_refspec_nr) {
55 + if (!refspec
56 + && !(flags & TRANSPORT_PUSH_ALL)
57 + && remote->push_refspec_nr) {
58 refspec = remote->push_refspec;
59 refspec_nr = remote->push_refspec_nr;
60 }
@@ -138,7 +140,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
140 usage(push_usage);
141 }
142 set_refspecs(argv + i, argc - i);
141 - if (all && refspec)
143 + if ((flags & TRANSPORT_PUSH_ALL) && refspec)
144 usage(push_usage);
145
146 return do_push(repo, flags);