提交 affa40d2 编写于 作者: C Catalin Marinas 提交者: Junio C Hamano

[PATCH] Make curl fail on server error

Some http servers return an HTML error page and git reads it as normal
data. Adding -f option makes curl fail silently.
Signed-off-by: NCatalin Marinas <catalin.marinas@gmail.com>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 3c4e8a63
......@@ -14,7 +14,7 @@ if [ -n "$GIT_SSL_NO_VERIFY" ]; then
fi
http_fetch () {
# $1 = Remote, $2 = Local
curl -ns $curl_extra_args "$1" >"$2"
curl -nsf $curl_extra_args "$1" >"$2"
}
cd "$D" &&
......
......@@ -15,7 +15,7 @@ http://* | https://*)
fi
_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' &&
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" &&
head=$(curl -ns $curl_extra_args "$merge_repo/$merge_head") &&
head=$(curl -nsf $curl_extra_args "$merge_repo/$merge_head") &&
expr "$head" : "$_x40\$" >/dev/null || {
echo >&2 "Failed to fetch $merge_head from $merge_repo"
exit 1
......
......@@ -46,7 +46,7 @@ http://* | https://* )
if [ -n "$GIT_SSL_NO_VERIFY" ]; then
curl_extra_args="-k"
fi
curl -ns $curl_extra_args "$peek_repo/info/refs" || exit 1
curl -nsf $curl_extra_args "$peek_repo/info/refs" || exit 1
;;
rsync://* )
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册