Skip to content

Commit bcc785f

Browse files
Linus TorvaldsJunio C Hamano
authored andcommitted
git push: add verbose flag and allow overriding of default target repository
This adds a command line flag "-v" to enable a more verbose mode, and "--repo=" to override the default target repository for "git push" (which otherwise always defaults to "origin"). This, together with the patch to allow dashes in config variable names, allows me to do [alias] push-all = push -v --repo=all in my user-global config file, and then I can (for any project I maintain) add to the project-local config file [remote "all"] url=one.target.repo:/directory url=another.target:/pub/somewhere/else and now "git push-all" just updates all the target repositories, and shows me what it does - regardless of which repo I am in. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 38c5afa commit bcc785f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

builtin-push.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
static const char push_usage[] = "git-push [--all] [--tags] [-f | --force] <repository> [<refspec>...]";
1212

13-
static int all, tags, force, thin = 1;
13+
static int all, tags, force, thin = 1, verbose;
1414
static const char *execute;
1515

1616
#define BUF_SIZE (2084)
@@ -248,6 +248,8 @@ static int do_push(const char *repo)
248248
while (dest_refspec_nr--)
249249
argv[dest_argc++] = *dest_refspec++;
250250
argv[dest_argc] = NULL;
251+
if (verbose)
252+
fprintf(stderr, "Pushing to %s\n", dest);
251253
err = run_command_v(argc, argv);
252254
if (!err)
253255
continue;
@@ -281,6 +283,14 @@ int cmd_push(int argc, const char **argv, const char *prefix)
281283
i++;
282284
break;
283285
}
286+
if (!strcmp(arg, "-v")) {
287+
verbose=1;
288+
continue;
289+
}
290+
if (!strncmp(arg, "--repo=", 7)) {
291+
repo = arg+7;
292+
continue;
293+
}
284294
if (!strcmp(arg, "--all")) {
285295
all = 1;
286296
continue;

0 commit comments

Comments
 (0)