Subject: [PATCH 09/10] push: teach push to pass --verbose option to transport layer

From: Steffen Prohaska <[email-masked]>
Date: Sun, 28 Oct 2007 18:46:20 +0100

A --verbose option to push should also be passed to the
transport layer, i.e. git-send-pack, git-http-push.

git push is modified to do so.

Signed-off-by: Steffen Prohaska <[email-masked]>
---
 builtin-push.c |    2 ++
 transport.c    |    8 ++++++--
 transport.h    |    1 +
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/builtin-push.c b/builtin-push.c
index 9103d57..27eaca5 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -110,10 +110,12 @@ int cmd_push(int argc, const char **argv, const char *prefix)
 		}
 		if (!strcmp(arg, "-v")) {
 			verbose=1;
+			flags |= TRANSPORT_PUSH_VERBOSE;
 			continue;
 		}
 		if (!strcmp(arg, "--verbose")) {
 			verbose=1;
+			flags |= TRANSPORT_PUSH_VERBOSE;
 			continue;
 		}
 		if (!prefixcmp(arg, "--repo=")) {
diff --git a/transport.c b/transport.c
index fbdbd0d..e6bca93 100644
--- a/transport.c
+++ b/transport.c
@@ -385,7 +385,7 @@ static int curl_transport_push(struct transport *transport, int refspec_nr, cons
 	int argc;
 	int err;
 
-	argv = xmalloc((refspec_nr + 12) * sizeof(char *));
+	argv = xmalloc((refspec_nr + 13) * sizeof(char *));
 	argv[0] = "http-push";
 	argc = 1;
 	if (flags & TRANSPORT_PUSH_ALL)
@@ -396,6 +396,8 @@ static int curl_transport_push(struct transport *transport, int refspec_nr, cons
 		argv[argc++] = "--dry-run";
 	if (flags & TRANSPORT_PUSH_CREATE)
 		argv[argc++] = "--create";
+	if (flags & TRANSPORT_PUSH_VERBOSE)
+		argv[argc++] = "--verbose";
 	argv[argc++] = transport->url;
 	while (refspec_nr--)
 		argv[argc++] = *refspec++;
@@ -660,7 +662,7 @@ static int git_transport_push(struct transport *transport, int refspec_nr, const
 	int argc;
 	int err;
 
-	argv = xmalloc((refspec_nr + 12) * sizeof(char *));
+	argv = xmalloc((refspec_nr + 13) * sizeof(char *));
 	argv[0] = "send-pack";
 	argc = 1;
 	if (flags & TRANSPORT_PUSH_ALL)
@@ -671,6 +673,8 @@ static int git_transport_push(struct transport *transport, int refspec_nr, const
 		argv[argc++] = "--dry-run";
 	if (flags & TRANSPORT_PUSH_CREATE)
 		argv[argc++] = "--create";
+	if (flags & TRANSPORT_PUSH_VERBOSE)
+		argv[argc++] = "--verbose";
 	if (data->receivepack) {
 		char *rp = xmalloc(strlen(data->receivepack) + 16);
 		sprintf(rp, "--receive-pack=%s", data->receivepack);
diff --git a/transport.h b/transport.h
index 1d6a926..a387eed 100644
--- a/transport.h
+++ b/transport.h
@@ -31,6 +31,7 @@ struct transport {
 #define TRANSPORT_PUSH_FORCE 2
 #define TRANSPORT_PUSH_DRY_RUN 4
 #define TRANSPORT_PUSH_CREATE 8
+#define TRANSPORT_PUSH_VERBOSE 16
 
 /* Returns a transport suitable for the url */
 struct transport *transport_get(struct remote *, const char *);
-- 
1.5.3.4.439.ge8b49