[PATCH] fetch-pack: make the ssh connection quiet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The --quiet option passed to fetch-pack did not affect the ssh child
process. When an ssh server sent a motd it was displayed because the ssh
client wasn't launched with the -q option. This patch makes ssh run quietly
when fetch-pack is called with -q.

An analogous change should be made to other commands which accept --quiet
and connect to remotes using ssh.

Signed-off-by: Jan StÄpieÅ <jstepien@xxxxxxxxxxxxxxxxxxxxx>
---
 builtin/fetch-pack.c |    3 ++-
 cache.h              |    1 +
 connect.c            |    2 ++
 3 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index dbd8b7b..ede1c34 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -876,7 +876,8 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
 		fd[1] = 1;
 	} else {
 		conn = git_connect(fd, (char *)dest, args.uploadpack,
-				   args.verbose ? CONNECT_VERBOSE : 0);
+				   (args.verbose ? CONNECT_VERBOSE : 0) |
+				   (args.quiet ? CONNECT_QUIET : 0));
 	}
 
 	get_remote_heads(fd[0], &ref, 0, NULL, 0, NULL);
diff --git a/cache.h b/cache.h
index 33decd9..8622a78 100644
--- a/cache.h
+++ b/cache.h
@@ -938,6 +938,7 @@ struct ref {
 extern struct ref *find_ref_by_name(const struct ref *list, const char *name);
 
 #define CONNECT_VERBOSE       (1u << 0)
+#define CONNECT_QUIET         (1u << 1)
 extern char *git_getpass(const char *prompt);
 extern struct child_process *git_connect(int fd[2], const char *url, const char *prog, int flags);
 extern int finish_connect(struct child_process *conn);
diff --git a/connect.c b/connect.c
index 57dc20c..709601e 100644
--- a/connect.c
+++ b/connect.c
@@ -585,6 +585,8 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
 			*arg++ = putty ? "-P" : "-p";
 			*arg++ = port;
 		}
+		if (!putty && flags & CONNECT_QUIET)
+			*arg++ = "-q";
 		*arg++ = host;
 	}
 	else {
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]