diff options
author | Jeff King <peff@peff.net> | 2013-04-05 18:17:23 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-04-06 18:56:42 -0700 |
commit | 426e70d4a11ce3b4f70636d57c6a0ab16ae08a00 (patch) | |
tree | cfceb7d3004125f264ab44d82f777d2777913c72 /notes-merge.c | |
parent | 6d052d78d74e581dd93dd6328d3c214f469e34d7 (diff) | |
download | git-426e70d4a11ce3b4f70636d57c6a0ab16ae08a00.tar.gz |
remote-curl: show server content on http errors
If an http request to a remote git server fails, we show
only the http response code, or sometimes a custom message
for particular codes. This gives the server no opportunity
to offer a more detailed explanation of the reason for the
failure, or to give extra advice.
This patch teaches remote-curl to record and display the
body content of a failed http response. We only display such
responses when the content-type is advertised as text/plain,
as it is the most likely to look presentable on the user's
terminal (and it is hoped to be a good indication that the
message is intended for git clients, and not for a web
browser).
Each line of the new output is prepended with "remote:".
Example output may look like this (assuming the server is
configured to display such a helpful message):
$ GIT_SMART_HTTP=0 git clone https://example.com/some/repo.git
Cloning into 'repo'...
remote: Sorry, fetching via dumb http is forbidden.
remote: Please upgrade your git client to v1.6.6 or greater
remote: and make sure that smart-http is enabled.
error: The requested URL returned error: 403 while accessing http://localhost:5001/some/repo.git/info/refs
fatal: HTTP request failed
For the sake of simplicity, we only record and display these
errors during the initial fetch of the ref list, as that is
the initial contact with the server and where the most
common, interesting errors happen (and there is already
precedent, as that is the only place we currently massage
http error codes into more helpful messages).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'notes-merge.c')
0 files changed, 0 insertions, 0 deletions