From: Linus Torvalds <torvalds@osdl.org>
To: Junio C Hamano <junkio@cox.net>, Git Mailing List <git@vger.kernel.org>
Subject: [PATCH 2/2] git push: add verbose flag and allow overriding of default target repository
Date: Mon, 30 Oct 2006 08:28:59 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0610300825470.25218@g5.osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0610300823250.25218@g5.osdl.org>
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>
---
Maybe this is just useful to me? I dunno. I have long had a per-repository
"push-all" script that I have in the root directory of the repos I
maintain, but this is much more practical. With this, I can do things like
git push-all --tags
and it will push all the new tags to all the public repositories I
maintain for that particular repository.
Special Linus-only behaviour? Maybe. On the other hand, I think this is a
pretty clean patch regardless.
diff --git a/builtin-push.c b/builtin-push.c
index f5150ed..3151fb7 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -10,7 +10,7 @@
static const char push_usage[] = "git-push [--all] [--tags] [-f | --force] <repository> [<refspec>...]";
-static int all, tags, force, thin = 1;
+static int all, tags, force, thin = 1, verbose;
static const char *execute;
#define BUF_SIZE (2084)
@@ -248,6 +248,8 @@ static int do_push(const char *repo)
while (dest_refspec_nr--)
argv[dest_argc++] = *dest_refspec++;
argv[dest_argc] = NULL;
+ if (verbose)
+ fprintf(stderr, "Pushing to %s\n", dest);
err = run_command_v(argc, argv);
if (!err)
continue;
@@ -281,6 +283,14 @@ int cmd_push(int argc, const char **argv
i++;
break;
}
+ if (!strcmp(arg, "-v")) {
+ verbose=1;
+ continue;
+ }
+ if (!strncmp(arg, "--repo=", 7)) {
+ repo = arg+7;
+ continue;
+ }
if (!strcmp(arg, "--all")) {
all = 1;
next prev parent reply other threads:[~2006-10-30 16:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-30 16:25 [PATCH 1/2] Allow '-' in config variable names Linus Torvalds
2006-10-30 16:28 ` Linus Torvalds [this message]
2006-10-30 23:02 ` [PATCH 2/2] git push: add verbose flag and allow overriding of default target repository Junio C Hamano
2006-10-31 3:09 ` Junio C Hamano
2006-10-30 22:45 ` [PATCH 1/2] Allow '-' in config variable names Junio C Hamano
2006-10-31 3:02 ` Junio C Hamano
2006-10-31 3:05 ` J. Bruce Fields
2006-10-31 3:23 ` Linus Torvalds
2006-10-31 9:49 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0610300825470.25218@g5.osdl.org \
--to=torvalds@osdl.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).