summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a240de1)
raw | patch | inline | side by side (parent: a240de1)
author | Tom Preston-Werner <tom@github.com> | |
Sat, 1 Nov 2008 18:44:45 +0000 (11:44 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 2 Nov 2008 08:54:29 +0000 (01:54 -0700) |
The current behavior of git-daemon is to simply close the connection on
any error condition. This leaves the client without any information as
to the cause of the failed fetch/push/etc.
This patch allows get_remote_heads to accept a line prefixed with "ERR"
that it can display to the user in an informative fashion. Once clients
can understand this ERR line, git-daemon can be made to properly report
"repository not found", "permission denied", or other errors.
Example
S: ERR No matching repository.
C: fatal: remote error: No matching repository.
Signed-off-by: Tom Preston-Werner <tom@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
any error condition. This leaves the client without any information as
to the cause of the failed fetch/push/etc.
This patch allows get_remote_heads to accept a line prefixed with "ERR"
that it can display to the user in an informative fashion. Once clients
can understand this ERR line, git-daemon can be made to properly report
"repository not found", "permission denied", or other errors.
Example
S: ERR No matching repository.
C: fatal: remote error: No matching repository.
Signed-off-by: Tom Preston-Werner <tom@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
connect.c | patch | blob | history |
diff --git a/connect.c b/connect.c
index 0c50d0a26a493f4505eee16812d14c5d7d1b7392..584e04c217da4ea8943e33c77fea56ce64547ed1 100644 (file)
--- a/connect.c
+++ b/connect.c
if (buffer[len-1] == '\n')
buffer[--len] = 0;
+ if (len > 4 && !prefixcmp(buffer, "ERR "))
+ die("remote error: %s", buffer + 4);
+
if (len < 42 || get_sha1_hex(buffer, old_sha1) || buffer[40] != ' ')
die("protocol error: expected sha/ref, got '%s'", buffer);
name = buffer + 41;