git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tay Ray Chuan <rctay89@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: "Jeff King" <peff@peff.net>,
	"Sebastian Thiel" <byronimo@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>
Subject: [PATCH 04/10] push: support multiple levels of verbosity
Date: Thu, 18 Feb 2010 20:37:05 +0800	[thread overview]
Message-ID: <1266496631-3980-5-git-send-email-rctay89@gmail.com> (raw)
In-Reply-To: <1266496631-3980-1-git-send-email-rctay89@gmail.com>

Remove the flags TRANSPORT_PUSH_QUIET and TRANSPORT_PUSH_VERBOSE; use
transport->verbose instead to determine verbosity for pushing.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---
 builtin-push.c     |    9 ++++++---
 transport-helper.c |    1 -
 transport.c        |    8 ++++----
 transport.h        |    2 --
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/builtin-push.c b/builtin-push.c
index 5633f0a..0082dad 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -17,6 +17,7 @@ static const char * const push_usage[] = {
 static int thin;
 static int deleterefs;
 static const char *receivepack;
+static int verbosity;
 
 static const char **refspec;
 static int refspec_nr;
@@ -105,13 +106,16 @@ static int push_with_options(struct transport *transport, int flags)
 {
 	int err;
 	int nonfastforward;
+
+	transport_set_verbosity(transport, verbosity);
+
 	if (receivepack)
 		transport_set_option(transport,
 				     TRANS_OPT_RECEIVEPACK, receivepack);
 	if (thin)
 		transport_set_option(transport, TRANS_OPT_THIN, "yes");
 
-	if (flags & TRANSPORT_PUSH_VERBOSE)
+	if (verbosity > 0)
 		fprintf(stderr, "Pushing to %s\n", transport->url);
 	err = transport_push(transport, refspec_nr, refspec, flags,
 			     &nonfastforward);
@@ -204,8 +208,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
 	int rc;
 	const char *repo = NULL;	/* default repository */
 	struct option options[] = {
-		OPT_BIT('q', "quiet", &flags, "be quiet", TRANSPORT_PUSH_QUIET),
-		OPT_BIT('v', "verbose", &flags, "be verbose", TRANSPORT_PUSH_VERBOSE),
+		OPT__VERBOSITY(&verbosity),
 		OPT_STRING( 0 , "repo", &repo, "repository", "repository"),
 		OPT_BIT( 0 , "all", &flags, "push all refs", TRANSPORT_PUSH_ALL),
 		OPT_BIT( 0 , "mirror", &flags, "mirror all refs",
diff --git a/transport-helper.c b/transport-helper.c
index 1077428..3d33697 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -576,7 +576,6 @@ static int push_refs(struct transport *transport,
 	if (buf.len == 0)
 		return 0;
 
-	transport->verbose = flags & TRANSPORT_PUSH_VERBOSE ? 1 : 0;
 	standard_options(transport);
 
 	if (flags & TRANSPORT_PUSH_DRY_RUN) {
diff --git a/transport.c b/transport.c
index 1632c4d..0655f65 100644
--- a/transport.c
+++ b/transport.c
@@ -788,8 +788,8 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re
 	args.send_mirror = !!(flags & TRANSPORT_PUSH_MIRROR);
 	args.force_update = !!(flags & TRANSPORT_PUSH_FORCE);
 	args.use_thin_pack = data->options.thin;
-	args.verbose = !!(flags & TRANSPORT_PUSH_VERBOSE);
-	args.quiet = !!(flags & TRANSPORT_PUSH_QUIET);
+	args.verbose = (transport->verbose > 0);
+	args.quiet = (transport->verbose < 0);
 	args.dry_run = !!(flags & TRANSPORT_PUSH_DRY_RUN);
 
 	ret = send_pack(&args, data->fd, data->conn, remote_refs,
@@ -1039,8 +1039,8 @@ int transport_push(struct transport *transport,
 			transport->get_refs_list(transport, 1);
 		struct ref *local_refs = get_local_heads();
 		int match_flags = MATCH_REFS_NONE;
-		int verbose = flags & TRANSPORT_PUSH_VERBOSE;
-		int quiet = flags & TRANSPORT_PUSH_QUIET;
+		int verbose = (transport->verbose > 0);
+		int quiet = (transport->verbose < 0);
 		int porcelain = flags & TRANSPORT_PUSH_PORCELAIN;
 		int pretend = flags & TRANSPORT_PUSH_DRY_RUN;
 		int ret, err;
diff --git a/transport.h b/transport.h
index 7d1a0b6..c0743b1 100644
--- a/transport.h
+++ b/transport.h
@@ -88,9 +88,7 @@ struct transport {
 #define TRANSPORT_PUSH_FORCE 2
 #define TRANSPORT_PUSH_DRY_RUN 4
 #define TRANSPORT_PUSH_MIRROR 8
-#define TRANSPORT_PUSH_VERBOSE 16
 #define TRANSPORT_PUSH_PORCELAIN 32
-#define TRANSPORT_PUSH_QUIET 64
 #define TRANSPORT_PUSH_SET_UPSTREAM 128
 
 /* Returns a transport suitable for the url */
-- 
1.7.0.27.g5d71b

  parent reply	other threads:[~2010-02-18 12:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-18 12:37 [PATCH 00/10] teach --progress to transport-related builtins Tay Ray Chuan
2010-02-18 12:37 ` [PATCH 01/10] Documentation/git-pull.txt: mention --quiet and --verbose for fetching Tay Ray Chuan
2010-02-18 21:11   ` Junio C Hamano
2010-02-19  6:31     ` Tay Ray Chuan
2010-02-18 12:37 ` [PATCH 02/10] Documentation/git-push.txt: put --quiet before --verbose Tay Ray Chuan
2010-02-18 12:37 ` [PATCH 03/10] fetch: refactor verbosity option handling into transport.[ch] Tay Ray Chuan
2010-02-18 12:37 ` Tay Ray Chuan [this message]
2010-02-18 12:37 ` [PATCH 05/10] clone: support multiple levels of verbosity Tay Ray Chuan
2010-02-18 12:37 ` [PATCH 06/10] transport->progress: use flag authoritatively Tay Ray Chuan
2010-02-18 12:37 ` [PATCH 07/10] push: learn --progress Tay Ray Chuan
2010-02-18 12:37 ` [PATCH 08/10] fetch: " Tay Ray Chuan
2010-02-18 12:37 ` [PATCH 09/10] pull: " Tay Ray Chuan
2010-02-18 12:37 ` [PATCH 10/10] transport: update flags to be in running order Tay Ray Chuan
2010-02-19  1:26 ` [PATCH 00/10] teach --progress to transport-related builtins Junio C Hamano
2010-02-19  6:31   ` Tay Ray Chuan
2010-02-19  7:53     ` 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=1266496631-3980-5-git-send-email-rctay89@gmail.com \
    --to=rctay89@gmail.com \
    --cc=byronimo@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.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).