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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed May 1, 2012 at 04:42 UTC 391b1f2003c425773c01799969368a517375b1a4
2 files changed +13 -2
builtin/send-pack.c
+12 -2
@@ -410,6 +410,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
410 const char *receivepack = "git-receive-pack";
411 int flags;
412 int nonfastforward = 0;
413 + int progress = -1;
414
415 argv++;
416 for (i = 1; i < argc; i++, argv++) {
@@ -452,6 +453,14 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
453 args.verbose = 1;
454 continue;
455 }
456 + if (!strcmp(arg, "--progress")) {
457 + progress = 1;
458 + continue;
459 + }
460 + if (!strcmp(arg, "--no-progress")) {
461 + progress = 0;
462 + continue;
463 + }
464 if (!strcmp(arg, "--thin")) {
465 args.use_thin_pack = 1;
466 continue;
@@ -492,8 +501,9 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
501 }
502 }
503
495 - if (!args.quiet)
496 - args.progress = isatty(2);
504 + if (progress == -1)
505 + progress = !args.quiet && isatty(2);
506 + args.progress = progress;
507
508 if (args.stateless_rpc) {
509 conn = NULL;
remote-curl.c
+1
@@ -774,6 +774,7 @@ static int push_git(struct discovery *heads, int nr_spec, char **specs)
774 argv[argc++] = "--quiet";
775 else if (options.verbosity > 1)
776 argv[argc++] = "--verbose";
777 + argv[argc++] = options.progress ? "--progress" : "--no-progress";
778 argv[argc++] = url;
779 for (i = 0; i < nr_spec; i++)
780 argv[argc++] = specs[i];