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

[PATCH 3/3] use SIDEBAND_*_ERROR constants in pack protocol

From
iheffner@gmail.com <iheffner@gmail.com>
Date
Dec 13, 2011, 18:28 UTC
Message-ID
<1323800931-37123-4-git-send-email-iheffner@gmail.com>
In-Reply-To
<1323800931-37123-1-git-send-email-iheffner@gmail.com>
From: Ivan Heffner <iheffner@gmail.com>

Switched calls to send_sideband() for pack protocol errors to use SIDEBAND_PROTOCOL_ERROR and SIDEBAND_REMOTE_ERROR in place of the sideband magic numbers of -2 and -1, respectively.

Signed-off-by: Ivan Heffner <iheffner@gmail.com>
---
 builtin/fetch-pack.c |    2 +-
 builtin/send-pack.c  |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index c6bc8eb..63e9ac4 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -245,7 +245,7 @@ static enum ack_type get_ack(int fd, unsigned char *result_sha1)
 static void send_request(int fd, struct strbuf *buf)
 {
 	if (args.stateless_rpc) {
-		send_sideband(fd, -1, buf->buf, buf->len, LARGE_PACKET_MAX);
+		send_sideband(fd, SIDEBAND_REMOTE_ERROR, buf->buf, buf->len, LARGE_PACKET_MAX);
 		packet_flush(fd);
 	} else
 		safe_write(fd, buf->buf, buf->len);
diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index e0b8030..67c9fe5 100644
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
@@ -96,7 +96,7 @@ static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *ext
 			ssize_t n = xread(po.out, buf, LARGE_PACKET_MAX);
 			if (n <= 0)
 				break;
-			send_sideband(fd, -1, buf, n, LARGE_PACKET_MAX);
+			send_sideband(fd, SIDEBAND_REMOTE_ERROR, buf, n, LARGE_PACKET_MAX);
 		}
 		free(buf);
 		close(po.out);
@@ -320,7 +320,7 @@ int send_pack(struct send_pack_args *args,
 	if (args->stateless_rpc) {
 		if (!args->dry_run && cmds_sent) {
 			packet_buf_flush(&req_buf);
-			send_sideband(out, -1, req_buf.buf, req_buf.len, LARGE_PACKET_MAX);
+			send_sideband(out, SIDEBAND_REMOTE_ERROR, req_buf.buf, req_buf.len, LARGE_PACKET_MAX);
 		}
 	} else {
 		safe_write(out, req_buf.buf, req_buf.len);
-- 
1.7.6.553.g917d7.dirty
Previous: iheffner@gmail.comNext: Junio C Hamano
Message 4 of 5 in “use constants for sideband communication channels”
  1. 0/3 use constants for sideband communication channelsiheffner@gmail.com, Dec 13, 2011
  2. 1/3 add constants for sideband communication channelsiheffner@gmail.com, Dec 13, 2011
  3. 2/3 switch sideband communication to use constantsiheffner@gmail.com, Dec 13, 2011
  4. 3/3 use SIDEBAND_*_ERROR constants in pack protocoliheffner@gmail.com, Dec 13, 2011
  5. Junio C HamanoDec 14, 2011

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.