aboutsummaryrefslogtreecommitdiff
path: root/git-fetch-script
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-07-25 22:42:18 -0700
committerJunio C Hamano <junkio@cox.net>2005-07-31 11:56:44 -0700
commit96155e55e175e7fed1d8ebd73557d339f35629d8 (patch)
treebeefc211f75f0fc195f8992d696353881fc9fa16 /git-fetch-script
parent80bd6f3064a6009cd18a4dab9ce6d29681cec4af (diff)
downloadgit-96155e55e175e7fed1d8ebd73557d339f35629d8.tar.gz
git-96155e55e175e7fed1d8ebd73557d339f35629d8.tar.xz
Fetch from a packed repository on dumb servers.
Implement fetching from a packed repository over http/https using the dumb server support files. I consider some parts of the logic should be in a separate C program, but it appears to work with my simple tests. I have backburnered it for a bit too long for my liking, so let's throw it out in the open and see what happens. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-fetch-script')
-rwxr-xr-xgit-fetch-script24
1 files changed, 22 insertions, 2 deletions
diff --git a/git-fetch-script b/git-fetch-script
index 34ddfc8cb..2040c125f 100755
--- a/git-fetch-script
+++ b/git-fetch-script
@@ -13,9 +13,29 @@ http://* | https://*)
if [ -n "$GIT_SSL_NO_VERIFY" ]; then
curl_extra_args="-k"
fi
- head=$(curl -ns $curl_extra_args "$merge_repo/$merge_head") || exit 1
+ _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") &&
+ expr "$head" : "$_x40\$" >/dev/null || {
+ echo >&2 "Failed to fetch $merge_head from $merge_repo"
+ exit 1
+ }
+ git-fetch-dumb-http "$head" "$@"
+ case "$?" in
+ 0) ;;
+ 2) no_dumb_http_support=1 ;;
+ *) exit;;
+ esac
echo Fetching "$merge_head" using http
- git-http-pull -v -a "$head" "$merge_repo/"
+ git-http-pull -v -a "$head" "$merge_repo/" || {
+ case "$no_dumb_http_support" in
+ 1)
+ echo >&2 "* This could be because the $merge_repo is packed without"
+ echo >&2 " preparing dumb server support files."
+ ;;
+ esac
+ exit 1
+ }
;;
rsync://*)
rsync -L "$merge_repo/$merge_head" "$TMP_HEAD" || exit 1