git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jan Stępień <jstepien@users.sourceforge.net>
Date
Oct 27, 2010, 14:27 UTC
Message-ID
<1288189628-4883-1-git-send-email-jstepien@users.sourceforge.net>

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@users.sourceforge.net>
---
 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
Next: Drew Northup
Message 1 of 5 in “fetch-pack: make the ssh connection quiet”
  1. fetch-pack: make the ssh connection quietJan Stępień, Oct 27, 2010
  2. Drew NorthupOct 27, 2010
  3. Jan StępieńOct 27, 2010
  4. Junio C HamanoOct 27, 2010
  5. Jan StępieńOct 28, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.