Skip to content

Commit

Permalink
Fix 'push --all branch...' error handling
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shawn O. Pearce committed Oct 16, 2007
1 parent 2e13e5d commit 18184f7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions builtin-push.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 18184f7

Please sign in to comment.