From 83a5ad61268bbfea7e0d3180528366690f951554 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 20 Feb 2007 03:01:44 +0100 Subject: fetch & clone: do not output progress when not on a tty This adds the option "--no-progress" to fetch-pack and upload-pack, and makes fetch and clone pass this option when stdout is not a tty. While at documenting that option, also document --strict and --timeout options for upload-pack. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- fetch-pack.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'fetch-pack.c') diff --git a/fetch-pack.c b/fetch-pack.c index c787106764..fc6b4e06b4 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -15,8 +15,9 @@ static int quiet; static int verbose; static int fetch_all; static int depth; +static int no_progress; static const char fetch_pack_usage[] = -"git-fetch-pack [--all] [--quiet|-q] [--keep|-k] [--thin] [--upload-pack=] [--depth=] [-v] [:] [...]"; +"git-fetch-pack [--all] [--quiet|-q] [--keep|-k] [--thin] [--upload-pack=] [--depth=] [--no-progress] [-v] [:] [...]"; static const char *uploadpack = "git-upload-pack"; #define COMPLETE (1U << 0) @@ -521,7 +522,7 @@ static int get_pack(int xd[2]) if (do_keep) { *av++ = "index-pack"; *av++ = "--stdin"; - if (!quiet) + if (!quiet && !no_progress) *av++ = "-v"; if (use_thin_pack) *av++ = "--fix-thin"; @@ -718,6 +719,10 @@ int main(int argc, char **argv) st.st_mtime = 0; continue; } + if (!strcmp("--no-progress", arg)) { + no_progress = 1; + continue; + } usage(fetch_pack_usage); } dest = arg; @@ -727,7 +732,12 @@ int main(int argc, char **argv) } if (!dest) usage(fetch_pack_usage); - pid = git_connect(fd, dest, uploadpack); + if (no_progress) { + char buf[256]; + snprintf(buf, sizeof(buf), "%s --no-progress", uploadpack); + pid = git_connect(fd, dest, buf); + } else + pid = git_connect(fd, dest, uploadpack); if (pid < 0) return 1; if (heads && nr_heads) -- cgit v1.2.3 From b0e908977ebe43b49badad7fe34bf259dd5d263b Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 23 Feb 2007 20:03:10 +0100 Subject: Fixup no-progress for fetch & clone The intent of the commit 'fetch & clone: do not output progress when not on a tty' was to make fetching and cloning less chatty when output was not redirected (such as in a cron job). However, there was a serious thinko in that commit. It assumed that the client _and_ the server got this update at the same time. But this is obviously not the case, and therefore upload-pack died on seeing the option "--no-progress". This patch fixes that issue by making it a protocol option. So, until your server is updated, you still see the progress, but once the server has this patch, it will be quiet. A minor issue was also fixed: when cloning, the checkout did not heed no_progress. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- fetch-pack.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'fetch-pack.c') diff --git a/fetch-pack.c b/fetch-pack.c index fc6b4e06b4..8428546271 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -174,12 +174,13 @@ static int find_common(int fd[2], unsigned char *result_sha1, } if (!fetching) - packet_write(fd[1], "want %s%s%s%s%s%s\n", + packet_write(fd[1], "want %s%s%s%s%s%s%s\n", sha1_to_hex(remote), (multi_ack ? " multi_ack" : ""), (use_sideband == 2 ? " side-band-64k" : ""), (use_sideband == 1 ? " side-band" : ""), (use_thin_pack ? " thin-pack" : ""), + (no_progress ? " no-progress" : ""), " ofs-delta"); else packet_write(fd[1], "want %s\n", sha1_to_hex(remote)); @@ -732,12 +733,7 @@ int main(int argc, char **argv) } if (!dest) usage(fetch_pack_usage); - if (no_progress) { - char buf[256]; - snprintf(buf, sizeof(buf), "%s --no-progress", uploadpack); - pid = git_connect(fd, dest, buf); - } else - pid = git_connect(fd, dest, uploadpack); + pid = git_connect(fd, dest, uploadpack); if (pid < 0) return 1; if (heads && nr_heads) -- cgit v1.2.3