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

Re: [PATCH] Fixup no-progress for fetch & clone

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 24, 2007, 01:19 UTC
Message-ID
<Pine.LNX.4.63.0702240217550.22628@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<7vfy8w3add.fsf@assigned-by-dhcp.cox.net>
Hi,

Since most servers will not have a no-progress aware upload-pack, how about this? (It is slightly ugly, but at least works...)

-- snipsnap -- [PATCH] git-fetch: add --no-progress, work around non-aware upload-pack

This adds the option "--no-progress" to git-fetch, and adds a workaround for the case when the other side's upload-pack does not support the "no-progress" extension: it skips the side-band packets ending in "done\r".

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 Documentation/fetch-options.txt |    5 +++++
 builtin-archive.c               |    2 +-
 fetch-pack.c                    |    2 +-
 git-fetch.sh                    |    3 +++
 sideband.c                      |    6 +++++-
 sideband.h                      |    2 +-
 6 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt
index 5b4d184..3afb28e 100644
--- a/Documentation/fetch-options.txt
+++ b/Documentation/fetch-options.txt
@@ -22,6 +22,11 @@
 	and stores them locally.  This option disables this
 	automatic tag following.
 
+\--no-progress::
+	Tell the other side not to show progress. If the other
+	side's upload-pack is new enough, it will actually
+	heed that request.
+
 -t, \--tags::
 	Most of the tags are fetched automatically as branch
 	heads are downloaded, but tags that do not point at
diff --git a/builtin-archive.c b/builtin-archive.c
index 8ea6cb1..3d3fd1b 100644
--- a/builtin-archive.c
+++ b/builtin-archive.c
@@ -72,7 +72,7 @@ static int run_remote_archiver(const char *remote, int argc,
 		die("git-archive: expected a flush");
 
 	/* Now, start reading from fd[0] and spit it out to stdout */
-	rv = recv_sideband("archive", fd[0], 1, 2);
+	rv = recv_sideband("archive", fd[0], 1, 2, 0);
 	close(fd[0]);
 	close(fd[1]);
 	rv |= finish_connect(pid);
diff --git a/fetch-pack.c b/fetch-pack.c
index 06f4aec..fd38616 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -482,7 +482,7 @@ static pid_t setup_sideband(int fd[2], int xd[2])
 		close(fd[0]);
 		if (xd[0] != xd[1])
 			close(xd[1]);
-		if (recv_sideband("fetch-pack", xd[0], fd[1], 2))
+		if (recv_sideband("fetch-pack", xd[0], fd[1], 2, no_progress))
 			exit(1);
 		exit(0);
 	}
diff --git a/git-fetch.sh b/git-fetch.sh
index 5ae0d28..e7a2be4 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -51,6 +51,9 @@ do
 	-n|--n|--no|--no-|--no-t|--no-ta|--no-tag|--no-tags)
 		no_tags=t
 		;;
+	--no-progress)
+		no_progress=--no-progress
+		;;
 	-u|--u|--up|--upd|--upda|--updat|--update|--update-|--update-h|\
 	--update-he|--update-hea|--update-head|--update-head-|\
 	--update-head-o|--update-head-ok)
diff --git a/sideband.c b/sideband.c
index 277fa3c..6a1a181 100644
--- a/sideband.c
+++ b/sideband.c
@@ -11,7 +11,8 @@
  * stream, aka "verbose").  A message over band #3 is a signal that
  * the remote died unexpectedly.  A flush() concludes the stream.
  */
-int recv_sideband(const char *me, int in_stream, int out, int err)
+int recv_sideband(const char *me, int in_stream, int out, int err,
+		int no_progress)
 {
 	char buf[7 + LARGE_PACKET_MAX + 1];
 	strcpy(buf, "remote:");
@@ -26,6 +27,9 @@ int recv_sideband(const char *me, int in_stream, int out, int err)
 			return SIDEBAND_PROTOCOL_ERROR;
 		}
 		band = buf[7] & 0xff;
+		if (no_progress && band != 3 && len > 7 + 5 &&
+				!prefixcmp(buf + 7 + len - 5, "done\r"))
+			continue;
 		len--;
 		switch (band) {
 		case 3:
diff --git a/sideband.h b/sideband.h
index a84b691..99a0e96 100644
--- a/sideband.h
+++ b/sideband.h
@@ -7,7 +7,7 @@
 #define DEFAULT_PACKET_MAX 1000
 #define LARGE_PACKET_MAX 65520
 
-int recv_sideband(const char *me, int in_stream, int out, int err);
+int recv_sideband(const char *me, int in_stream, int out, int err, int no_progress);
 ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max);
 
 #endif
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 16 in “Fixup no-progress for fetch & clone”
  1. Fixup no-progress for fetch & cloneJohannes Schindelin, Feb 23, 2007
  2. Junio C HamanoFeb 23, 2007
  3. Johannes SchindelinFeb 24, 2007
  4. Junio C HamanoFeb 24, 2007
  5. Johannes SchindelinFeb 24, 2007
  6. Nicolas PitreFeb 24, 2007
  7. Junio C HamanoFeb 24, 2007
  8. Johannes SchindelinFeb 24, 2007
  9. Nicolas PitreFeb 24, 2007
  10. Johannes SchindelinFeb 24, 2007
  11. Nicolas PitreFeb 24, 2007
  12. Junio C HamanoFeb 24, 2007
  13. Nicolas PitreFeb 24, 2007
  14. Junio C HamanoFeb 24, 2007
  15. Nicolas PitreFeb 24, 2007
  16. Jakub NarebskiFeb 24, 2007

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.