git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] teach send-pack about --[no-]progress

From
Jeff King <peff@peff.net>
Date
May 1, 2012, 08:42 UTC
Message-ID
<20120501084224.GB4998@sigill.intra.peff.net>
In-Reply-To
<20120501084048.GA21904@sigill.intra.peff.net>

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>
---
 builtin/send-pack.c |   14 ++++++++++++--
 remote-curl.c       |    1 +
 2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index 7d22715..d5d7105 100644
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
@@ -410,6 +410,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
 	const char *receivepack = "git-receive-pack";
 	int flags;
 	int nonfastforward = 0;
+	int progress = -1;
 
 	argv++;
 	for (i = 1; i < argc; i++, argv++) {
@@ -452,6 +453,14 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
 				args.verbose = 1;
 				continue;
 			}
+			if (!strcmp(arg, "--progress")) {
+				progress = 1;
+				continue;
+			}
+			if (!strcmp(arg, "--no-progress")) {
+				progress = 0;
+				continue;
+			}
 			if (!strcmp(arg, "--thin")) {
 				args.use_thin_pack = 1;
 				continue;
@@ -492,8 +501,9 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
 		}
 	}
 
-	if (!args.quiet)
-		args.progress = isatty(2);
+	if (progress == -1)
+		progress = !args.quiet && isatty(2);
+	args.progress = progress;
 
 	if (args.stateless_rpc) {
 		conn = NULL;
diff --git a/remote-curl.c b/remote-curl.c
index d159fe7..e5e9490 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -774,6 +774,7 @@ static int push_git(struct discovery *heads, int nr_spec, char **specs)
 		argv[argc++] = "--quiet";
 	else if (options.verbosity > 1)
 		argv[argc++] = "--verbose";
+	argv[argc++] = options.progress ? "--progress" : "--no-progress";
 	argv[argc++] = url;
 	for (i = 0; i < nr_spec; i++)
 		argv[argc++] = specs[i];
-- 
1.7.10.630.g31718
Previous: Jeff KingNext: Jeff King
Message 5 of 14 in “Re: 1.7.10 doesn't show file pushstatus”
  1. Jeff KingMay 1, 2012
  2. Jeff KingMay 1, 2012
  3. Jeff KingMay 1, 2012
  4. 1/3 send-pack: show progress when isatty(2)Jeff King, May 1, 2012
  5. 2/3 teach send-pack about --[no-]progressJeff King, May 1, 2012
  6. 3/3 t5541: test more combinations of --progressJeff King, May 1, 2012
  7. Clemens BuchacherMay 1, 2012
  8. Jeff KingMay 1, 2012
  9. David EbboMay 1, 2012
  10. Zbigniew Jędrzejewski-SzmekMay 1, 2012
  11. Junio C HamanoMay 1, 2012
  12. Clemens BuchacherMay 1, 2012
  13. Junio C HamanoMay 1, 2012
  14. Johannes SchindelinMay 2, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.