git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] connect.c: add a way for git-daemon to pass an error back to client
@ 2008-11-01  1:59 Tom Preston-Werner
  2008-11-01  2:19 ` Johannes Schindelin
  2008-11-01  5:39 ` Junio C Hamano
  0 siblings, 2 replies; 13+ messages in thread
From: Tom Preston-Werner @ 2008-11-01  1:59 UTC (permalink / raw)
  To: git; +Cc: gitster

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>
---
 connect.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/connect.c b/connect.c
index 0c50d0a..3af91d6 100644
--- a/connect.c
+++ b/connect.c
@@ -70,6 +70,9 @@ struct ref **get_remote_heads(int in, struct ref **list,
 		if (buffer[len-1] == '\n')
 			buffer[--len] = 0;

+		if (len > 4 && !memcmp("ERR", buffer, 3))
+			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;
-- 
1.6.0.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-11-01 22:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-01  1:59 [PATCH] connect.c: add a way for git-daemon to pass an error back to client Tom Preston-Werner
2008-11-01  2:19 ` Johannes Schindelin
2008-11-01  2:18   ` Tom Preston-Werner
2008-11-01  2:20   ` Nicolas Pitre
2008-11-01  2:35     ` Johannes Schindelin
2008-11-01  3:35       ` Tom Preston-Werner
2008-11-01 11:34         ` Andreas Ericsson
2008-11-01 14:39         ` Alex Riesen
2008-11-01 11:30     ` Andreas Ericsson
2008-11-01  5:39 ` Junio C Hamano
2008-11-01  6:29   ` Tom Preston-Werner
2008-11-01 18:10     ` Shawn O. Pearce
2008-11-01 22:48     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).