{"thread":{"id":"1452","subject":"[PATCH] Make curl fail on server error","startedAt":"2005-08-08T09:53:23Z","lastAt":"2005-08-08T09:53:23Z","messageCount":1,"participants":["Catalin Marinas"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"6934","messageId":"20050808095323.31602.76855.stgit@localhost.localdomain","threadId":"1452","inReplyTo":null,"subject":"[PATCH] Make curl fail on server error","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2005-08-08T09:53:23Z","receivedAt":"2005-08-08T09:53:23Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"Some http servers return an HTML error page and git reads it as normal\ndata. Adding -f option makes curl fail silently.\n\nSigned-off-by: Catalin Marinas <catalin.marinas@gmail.com>\n---\n\n git-clone-dumb-http  |    2 +-\n git-fetch-script     |    2 +-\n git-ls-remote-script |    2 +-\n 3 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/git-clone-dumb-http b/git-clone-dumb-http\n--- a/git-clone-dumb-http\n+++ b/git-clone-dumb-http\n@@ -14,7 +14,7 @@ if [ -n \"$GIT_SSL_NO_VERIFY\" ]; then\n fi\n http_fetch () {\n \t# $1 = Remote, $2 = Local\n-\tcurl -ns $curl_extra_args \"$1\" >\"$2\"\n+\tcurl -nsf $curl_extra_args \"$1\" >\"$2\"\n }\n \n cd \"$D\" && \ndiff --git a/git-fetch-script b/git-fetch-script\n--- a/git-fetch-script\n+++ b/git-fetch-script\n@@ -15,7 +15,7 @@ http://* | https://*)\n         fi\n \t_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' &&\n \t_x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\" &&\n-\thead=$(curl -ns $curl_extra_args \"$merge_repo/$merge_head\") &&\n+\thead=$(curl -nsf $curl_extra_args \"$merge_repo/$merge_head\") &&\n \texpr \"$head\" : \"$_x40\\$\" >/dev/null || {\n \t\techo >&2 \"Failed to fetch $merge_head from $merge_repo\"\n \t        exit 1\ndiff --git a/git-ls-remote-script b/git-ls-remote-script\n--- a/git-ls-remote-script\n+++ b/git-ls-remote-script\n@@ -46,7 +46,7 @@ http://* | https://* )\n         if [ -n \"$GIT_SSL_NO_VERIFY\" ]; then\n             curl_extra_args=\"-k\"\n         fi\n-\tcurl -ns $curl_extra_args \"$peek_repo/info/refs\" || exit 1\n+\tcurl -nsf $curl_extra_args \"$peek_repo/info/refs\" || exit 1\n \t;;\n \n rsync://* )\n"}]}