@matheusbsbs / matheus-bagliano / commits / b0e908977e
Fork 0

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 <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>

Johannes Schindelin committed Feb 23, 2007 at 20:03 UTC b0e908977ebe43b49badad7fe34bf259dd5d263b
4 files changed +9 -18
Documentation/git-upload-pack.txt
+1 -4
@@ -8,7 +8,7 @@ git-upload-pack - Send objects packed back to git-fetch-pack
8
9 SYNOPSIS
10 --------
11 -'git-upload-pack' [--strict] [--timeout=<n>] [--no-progress] <directory>
11 +'git-upload-pack' [--strict] [--timeout=<n>] <directory>
12
13 DESCRIPTION
14 -----------
@@ -30,9 +30,6 @@ OPTIONS
30 \--timeout=<n>::
31 Interrupt transfer after <n> seconds of inactivity.
32
33 -\--no-progress::
34 - Do not show the progress.
35 -
33 <directory>::
34 The repository to sync from.
35
fetch-pack.c
+3 -7
@@ -174,12 +174,13 @@ static int find_common(int fd[2], unsigned char *result_sha1,
174 }
175
176 if (!fetching)
177 - packet_write(fd[1], "want %s%s%s%s%s%s\n",
177 + packet_write(fd[1], "want %s%s%s%s%s%s%s\n",
178 sha1_to_hex(remote),
179 (multi_ack ? " multi_ack" : ""),
180 (use_sideband == 2 ? " side-band-64k" : ""),
181 (use_sideband == 1 ? " side-band" : ""),
182 (use_thin_pack ? " thin-pack" : ""),
183 + (no_progress ? " no-progress" : ""),
184 " ofs-delta");
185 else
186 packet_write(fd[1], "want %s\n", sha1_to_hex(remote));
@@ -732,12 +733,7 @@ int main(int argc, char **argv)
733 }
734 if (!dest)
735 usage(fetch_pack_usage);
735 - if (no_progress) {
736 - char buf[256];
737 - snprintf(buf, sizeof(buf), "%s --no-progress", uploadpack);
738 - pid = git_connect(fd, dest, buf);
739 - } else
740 - pid = git_connect(fd, dest, uploadpack);
736 + pid = git_connect(fd, dest, uploadpack);
737 if (pid < 0)
738 return 1;
739 if (heads && nr_heads)
git-clone.sh
+1 -1
@@ -395,7 +395,7 @@ then
395
396 case "$no_checkout" in
397 '')
398 - test "z$quiet" = z && v=-v || v=
398 + test "z$quiet" = z -a "z$no_progress" = z && v=-v || v=
399 git-read-tree -m -u $v HEAD HEAD
400 esac
401 fi
upload-pack.c
+4 -6
@@ -10,7 +10,7 @@
10 #include "revision.h"
11 #include "list-objects.h"
12
13 -static const char upload_pack_usage[] = "git-upload-pack [--strict] [--timeout=nn] [--no-progress] <dir>";
13 +static const char upload_pack_usage[] = "git-upload-pack [--strict] [--timeout=nn] <dir>";
14
15 /* bits #0..7 in revision.h, #8..10 in commit.c */
16 #define THEY_HAVE (1u << 11)
@@ -547,6 +547,8 @@ static void receive_needs(void)
547 use_sideband = LARGE_PACKET_MAX;
548 else if (strstr(line+45, "side-band"))
549 use_sideband = DEFAULT_PACKET_MAX;
550 + if (strstr(line+45, "no-progress"))
551 + no_progress = 1;
552
553 /* We have sent all our refs already, and the other end
554 * should have chosen out of them; otherwise they are
@@ -615,7 +617,7 @@ static void receive_needs(void)
617 static int send_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
618 {
619 static const char *capabilities = "multi_ack thin-pack side-band"
618 - " side-band-64k ofs-delta shallow";
620 + " side-band-64k ofs-delta shallow no-progress";
621 struct object *o = parse_object(sha1);
622
623 if (!o)
@@ -670,10 +672,6 @@ int main(int argc, char **argv)
672 timeout = atoi(arg+10);
673 continue;
674 }
673 - if (!strcmp(arg, "--no-progress")) {
674 - no_progress = 1;
675 - continue;
676 - }
675 if (!strcmp(arg, "--")) {
676 i++;
677 break;