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>
Linus Torvalds committed
Oct 30, 2006 at 08:28 UTC
bcc785f611dc6084be75999a3b6bafcc950e21d6
1 file changed
+11
-1
builtin-push.c
+11
-1
@@ -10,7 +10,7 @@
10
11
static const char push_usage[] = "git-push [--all] [--tags] [-f | --force] <repository> [<refspec>...]";
12
13
-static int all, tags, force, thin = 1;
13
+static int all, tags, force, thin = 1, verbose;
14
static const char *execute;
15
16
#define BUF_SIZE (2084)
@@ -248,6 +248,8 @@ static int do_push(const char *repo)
248
while (dest_refspec_nr--)
249
argv[dest_argc++] = *dest_refspec++;
250
argv[dest_argc] = NULL;
251
+ if (verbose)
252
+ fprintf(stderr, "Pushing to %s\n", dest);
253
err = run_command_v(argc, argv);
254
if (!err)
255
continue;
@@ -281,6 +283,14 @@ int cmd_push(int argc, const char **argv, const char *prefix)
283
i++;
284
break;
285
}
286
+ if (!strcmp(arg, "-v")) {
287
+ verbose=1;
288
+ continue;
289
+ }
290
+ if (!strncmp(arg, "--repo=", 7)) {
291
+ repo = arg+7;
292
+ continue;
293
+ }
294
if (!strcmp(arg, "--all")) {
295
all = 1;
296
continue;