Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 391b1f2

Browse files
peffgitster
authored andcommitted
teach send-pack about --[no-]progress
The send_pack function gets a "progress" flag saying "yes, definitely show progress" or "no, definitely do not show progress". This gets set properly by transport_push when send_pack is called directly. However, when the send-pack command is executed separately (as it is for the remote-curl helper), there is no way to tell it "definitely do this". As a result, we do not properly respect "git push --no-progress" for smart-http remotes; you will still get progress if stderr is a tty. This patch teaches send-pack --progress and --no-progress, and teaches remote-curl to pass the appropriate option to override send-pack's isatty check. This fixes the --no-progress case above, and as a bonus, also makes "git push --progress" work when stderr is not a tty. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8d32e60 commit 391b1f2

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

builtin/send-pack.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
410410
const char *receivepack = "git-receive-pack";
411411
int flags;
412412
int nonfastforward = 0;
413+
int progress = -1;
413414

414415
argv++;
415416
for (i = 1; i < argc; i++, argv++) {
@@ -452,6 +453,14 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
452453
args.verbose = 1;
453454
continue;
454455
}
456+
if (!strcmp(arg, "--progress")) {
457+
progress = 1;
458+
continue;
459+
}
460+
if (!strcmp(arg, "--no-progress")) {
461+
progress = 0;
462+
continue;
463+
}
455464
if (!strcmp(arg, "--thin")) {
456465
args.use_thin_pack = 1;
457466
continue;
@@ -492,8 +501,9 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
492501
}
493502
}
494503

495-
if (!args.quiet)
496-
args.progress = isatty(2);
504+
if (progress == -1)
505+
progress = !args.quiet && isatty(2);
506+
args.progress = progress;
497507

498508
if (args.stateless_rpc) {
499509
conn = NULL;

remote-curl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,7 @@ static int push_git(struct discovery *heads, int nr_spec, char **specs)
774774
argv[argc++] = "--quiet";
775775
else if (options.verbosity > 1)
776776
argv[argc++] = "--verbose";
777+
argv[argc++] = options.progress ? "--progress" : "--no-progress";
777778
argv[argc++] = url;
778779
for (i = 0; i < nr_spec; i++)
779780
argv[argc++] = specs[i];

0 commit comments

Comments
 (0)