Skip to content

Commit b0e9089

Browse files
dschoJunio C Hamano
authored andcommitted
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>
1 parent 83a5ad6 commit b0e9089

File tree

4 files changed

+9
-18
lines changed

4 files changed

+9
-18
lines changed

Documentation/git-upload-pack.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ git-upload-pack - Send objects packed back to git-fetch-pack
88

99
SYNOPSIS
1010
--------
11-
'git-upload-pack' [--strict] [--timeout=<n>] [--no-progress] <directory>
11+
'git-upload-pack' [--strict] [--timeout=<n>] <directory>
1212

1313
DESCRIPTION
1414
-----------
@@ -30,9 +30,6 @@ OPTIONS
3030
\--timeout=<n>::
3131
Interrupt transfer after <n> seconds of inactivity.
3232

33-
\--no-progress::
34-
Do not show the progress.
35-
3633
<directory>::
3734
The repository to sync from.
3835

fetch-pack.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,13 @@ static int find_common(int fd[2], unsigned char *result_sha1,
174174
}
175175

176176
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",
178178
sha1_to_hex(remote),
179179
(multi_ack ? " multi_ack" : ""),
180180
(use_sideband == 2 ? " side-band-64k" : ""),
181181
(use_sideband == 1 ? " side-band" : ""),
182182
(use_thin_pack ? " thin-pack" : ""),
183+
(no_progress ? " no-progress" : ""),
183184
" ofs-delta");
184185
else
185186
packet_write(fd[1], "want %s\n", sha1_to_hex(remote));
@@ -732,12 +733,7 @@ int main(int argc, char **argv)
732733
}
733734
if (!dest)
734735
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);
741737
if (pid < 0)
742738
return 1;
743739
if (heads && nr_heads)

git-clone.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ then
395395

396396
case "$no_checkout" in
397397
'')
398-
test "z$quiet" = z && v=-v || v=
398+
test "z$quiet" = z -a "z$no_progress" = z && v=-v || v=
399399
git-read-tree -m -u $v HEAD HEAD
400400
esac
401401
fi

upload-pack.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "revision.h"
1111
#include "list-objects.h"
1212

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>";
1414

1515
/* bits #0..7 in revision.h, #8..10 in commit.c */
1616
#define THEY_HAVE (1u << 11)
@@ -547,6 +547,8 @@ static void receive_needs(void)
547547
use_sideband = LARGE_PACKET_MAX;
548548
else if (strstr(line+45, "side-band"))
549549
use_sideband = DEFAULT_PACKET_MAX;
550+
if (strstr(line+45, "no-progress"))
551+
no_progress = 1;
550552

551553
/* We have sent all our refs already, and the other end
552554
* should have chosen out of them; otherwise they are
@@ -615,7 +617,7 @@ static void receive_needs(void)
615617
static int send_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
616618
{
617619
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";
619621
struct object *o = parse_object(sha1);
620622

621623
if (!o)
@@ -670,10 +672,6 @@ int main(int argc, char **argv)
670672
timeout = atoi(arg+10);
671673
continue;
672674
}
673-
if (!strcmp(arg, "--no-progress")) {
674-
no_progress = 1;
675-
continue;
676-
}
677675
if (!strcmp(arg, "--")) {
678676
i++;
679677
break;

0 commit comments

Comments
 (0)