git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Git List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] push: give early feedback
Date: Mon, 24 Jun 2013 23:11:02 +0530	[thread overview]
Message-ID: <1372095662-24527-1-git-send-email-artagnon@gmail.com> (raw)

There are many configuration variables that determine exactly what a
push does.  Give the user early feedback so that she has a chance to
abort if she doesn't mean to push those refspecs to that destination
like:

  $ git push
  # pushing refspecs 'master next' to ram (^C to abort)

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 Goes without saying: this is an early preview.

 builtin/push.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/builtin/push.c b/builtin/push.c
index 2d84d10..085d5ab 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -330,6 +330,7 @@ static int do_push(const char *repo, int flags)
 {
 	int i, errs;
 	struct remote *remote = pushremote_get(repo);
+	struct strbuf sb = STRBUF_INIT;
 	const char **url;
 	int url_nr;
 
@@ -375,6 +376,11 @@ static int do_push(const char *repo, int flags)
 	}
 	errs = 0;
 	url_nr = push_url_of_remote(remote, &url);
+
+	for (i = 0; i < refspec_nr; i++)
+		strbuf_addf(&sb, "%s%s", refspec[i], i == refspec_nr - 1 ? "": " ");
+	printf("# pushing refspecs '%s' to %s (^C to abort)\n", sb.buf, remote->name);
+
 	if (url_nr) {
 		for (i = 0; i < url_nr; i++) {
 			struct transport *transport =
-- 
1.8.3.1.549.g1f3a412.dirty

             reply	other threads:[~2013-06-24 17:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-24 17:41 Ramkumar Ramachandra [this message]
2013-06-24 18:04 ` [PATCH] push: give early feedback Fredrik Gustafsson
2013-06-24 18:24   ` Junio C Hamano
2013-06-24 18:28 ` Jeff King
2013-06-24 18:42   ` Ramkumar Ramachandra
2013-06-24 18:55     ` Jeff King
2013-06-24 19:24       ` Ramkumar Ramachandra
2013-06-24 19:39         ` Jeff King

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=1372095662-24527-1-git-send-email-artagnon@gmail.com \
    --to=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).