Browse Source

Allow "ACK" and "NACK" (without new line) in client.py

While working in my own environment the archive was failing for me
with "invalid response ACK" message. Looks like my git (hosted gerrit)
returns ACK instead of "ACK\n" expected by that code. As the shell
git clients works well with my server, seems like both versions should be
supported by the library.
DzmitrySudnik 4 years ago
parent
commit
4974d15710
1 changed files with 2 additions and 2 deletions
  1. 2 2
      dulwich/client.py

+ 2 - 2
dulwich/client.py

@@ -969,9 +969,9 @@ class TraditionalGitClient(GitClient):
                 pkt = proto.read_pkt_line()
                 pkt = proto.read_pkt_line()
             except HangupException:
             except HangupException:
                 raise _remote_error_from_stderr(stderr)
                 raise _remote_error_from_stderr(stderr)
-            if pkt == b"NACK\n":
+            if pkt == b"NACK\n" or pkt == b"NACK":
                 return
                 return
-            elif pkt == b"ACK\n":
+            elif pkt == b"ACK\n" or pkt == b"ACK":
                 pass
                 pass
             elif pkt.startswith(b"ERR "):
             elif pkt.startswith(b"ERR "):
                 raise GitProtocolError(
                 raise GitProtocolError(