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

[PATCH 3/3] receive-pack: drop "n/a" on unpacker errors

From
Jeff King <peff@peff.net>
Date
Sep 21, 2012, 05:38 UTC
Message-ID
<20120921053846.GC9863@sigill.intra.peff.net>
In-Reply-To
<20120921053057.GA9768@sigill.intra.peff.net>
The output from git push currently looks like this:
  $ git push dest HEAD
  fatal: [some message from index-pack]
  error: unpack failed: index-pack abnormal exit
  To dest
   ! [remote rejected] HEAD -> master (n/a (unpacker error))

That n/a is meant to be "the per-ref status is not available" but the nested parentheses just make it look ugly. Let's turn the final line into just:

   ! [remote rejected] HEAD -> master (unpacker error)
Signed-off-by: Jeff King <peff@peff.net>
---
Maybe it is just me, but I have always found the "n/a" and extra
parentheses ugly and unnecessary. But obviously others may differ.
It doesn't really come up that often, since index-pack failing usually
implies a git bug. But with transfer.fsckObjects turn on, it is more
common.

I don't think there should be any backwards compatibility issues with changing this. The "reason" field sent back by receive-pack has always been a free-form human-readable string.

I also dislike the "index-pack abnormal exit" message. Again, when index-pack really crashes, it's fine, but it can die due to bogus objects, too, in which case it might be nice to have a more human-readable message.

 builtin/receive-pack.c          | 2 +-
 t/t5504-fetch-receive-strict.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index ac679ab..ff781fe 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -695,7 +695,7 @@ static void execute_commands(struct command *commands, const char *unpacker_erro
 
 	if (unpacker_error) {
 		for (cmd = commands; cmd; cmd = cmd->next)
-			cmd->error_string = "n/a (unpacker error)";
+			cmd->error_string = "unpacker error";
 		return;
 	}
 
diff --git a/t/t5504-fetch-receive-strict.sh b/t/t5504-fetch-receive-strict.sh
index 35ec294..69ee13c 100755
--- a/t/t5504-fetch-receive-strict.sh
+++ b/t/t5504-fetch-receive-strict.sh
@@ -89,7 +89,7 @@ To dst
 
 cat >exp <<EOF
 To dst
-!	refs/heads/master:refs/heads/test	[remote rejected] (n/a (unpacker error))
+!	refs/heads/master:refs/heads/test	[remote rejected] (unpacker error)
 EOF
 
 test_expect_success 'push with receive.fsckobjects' '
-- 
1.7.11.7.15.g085c6bd
Previous: Jeff King
Message 8 of 8 in “nicer receive-pack errors over http”
  1. 0/3 nicer receive-pack errors over httpJeff King, Sep 21, 2012
  2. 1/3 receive-pack: redirect unpack-objects stdout to /dev/nullJeff King, Sep 21, 2012
  3. 2/3 receive-pack: send pack-processing stderr over sidebandJeff King, Sep 21, 2012
  4. Junio C HamanoSep 21, 2012
  5. Jeff KingSep 21, 2012
  6. Junio C HamanoSep 21, 2012
  7. Jeff KingSep 21, 2012
  8. 3/3 receive-pack: drop "n/a" on unpacker errorsJeff King, Sep 21, 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.