Package: git
Version: 1:2.0.0-1
Severity: wishlist
Tags: upstream patch

Talking to a custom git server that has a separate quota for
negotiation:

 $ git fetch origin; # https://<something>
 fatal: git fetch_pack: expected ACK/NAK, got 'ERR User Is Over Quota'
 fatal: The remote end hung up unexpectedly

Three buglets:
 i. there's a s/-/_/ typo (and has always been, since v0.99~80, 2005-07-04).

 ii. it would be nice to handle the ERR packet instead of showing it as an
     internal error (git archive --remote already accepts an ERR packet
     in the analagous context.)

 iii. why the 'remote end hung up unexpectedly' message after fetch-pack
      has already printed a message and died?

(ii) could be handled with a patch like the following:

-- >8 --
Subject: fetch-pack: handle "ERR" line during object negotiation

In addition to the current ACK / NACK responses, also accept ERR.
This produces a slightly nicer message when a (custom) server is
fed up with the client wasting its cycles during negotiation.

Before:

 $ git fetch origin
 fatal: git fetch_pack: expected ACK/NAK, got 'ERR User Is Over Quota'
 fatal: The remote end hung up unexpectedly

After:

 $ git fetch origin
 fatal: remote error: User Is Over Quota
 fatal: The remote end hung up unexpectedly

Getting rid of the spurious 'The remote end hung up' message is a
problem for another day.

Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
---
 Documentation/technical/pack-protocol.txt | 2 +-
 fetch-pack.c                              | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/technical/pack-protocol.txt 
b/Documentation/technical/pack-protocol.txt
index dc486b1..f097bcb 100644
--- a/Documentation/technical/pack-protocol.txt
+++ b/Documentation/technical/pack-protocol.txt
@@ -347,7 +347,7 @@ if there is no common base found.
 Then the server will start sending its packfile data.
 
 ----
-  server-response = *(ack_multi / ack / nak)
+  server-response = *(ack_multi / ack / nak / error-line)
   ack_multi       = PKT-LINE("ACK" SP obj-id ack_status LF)
   ack_status      = "continue" / "common" / "ready"
   ack             = PKT-LINE("ACK SP obj-id LF)
diff --git a/fetch-pack.c b/fetch-pack.c
index b8a58fa..ccf2fde 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -210,6 +210,8 @@ static enum ack_type get_ack(int fd, unsigned char 
*result_sha1)
                        return ACK;
                }
        }
+       if (skip_prefix(line, "ERR ", &arg))
+               die("remote error: %s", arg);
        die("git fetch_pack: expected ACK/NAK, got '%s'", line);
 }
 
-- 


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to