From: Junio C Hamano <gitster@pobox.com>
To: "Tom Preston-Werner" <tom@github.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] connect.c: add a way for git-daemon to pass an error back to client
Date: Fri, 31 Oct 2008 22:39:58 -0700 [thread overview]
Message-ID: <7vy7043sy9.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <b97024a40810311859t2e5a6102u31ad4480e7c75c03@mail.gmail.com> (Tom Preston-Werner's message of "Fri, 31 Oct 2008 18:59:46 -0700")
"Tom Preston-Werner" <tom@github.com> writes:
> Example
>
> S: ERR No matching repository.
> C: fatal: remote error: No matching repository.
I like what this tries to do.
I briefly wondered if this should be restricted to the very first message
from the other end, but I think it is not necessary. If the remote throws
a few valid looking "SHA-1 SP refname" lines and then said "ERR" (which
cannot be the beginning of a valid SHA-1), we can safely and unambiguously
declare that this is an error message from the remote end.
> 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))
Would matching 4 bytes "ERR " here an improvement? You are expecting
buffer+4 is where the message begins in die() anyway, and otherwise you
would show the message without "N" if you got "ERRNo matching repo".
> + die("remote error: %s", buffer + 4);
> +
It was very considerate that you did not say "server error" in the error
message. This code is shared between both the fetch side and the push
side.
next prev parent reply other threads:[~2008-11-01 5:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2008-11-01 6:29 ` Tom Preston-Werner
2008-11-01 18:10 ` Shawn O. Pearce
2008-11-01 22:48 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vy7043sy9.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=tom@github.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).