[PATCH 14/16] git-clone: rely on git-fetch for non-bare fetching over http
From: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
---
git-clone.sh | 6 +++---
git-fetch.sh | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/git-clone.sh b/git-clone.sh
index 44127c5..44387f4 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -262,8 +262,8 @@ yes,yes)
git-ls-remote "$repo" >"$GIT_DIR/CLONE_HEAD" || exit 1
;;
*)
- case "$repo" in
- rsync://*)
+ case "$bare,$repo" in
+ *,rsync://*)
case "$depth" in
"") ;;
*) die "shallow over rsync not supported" ;;
@@ -295,7 +295,7 @@ yes,yes)
fi
git-ls-remote "$repo" >"$GIT_DIR/CLONE_HEAD" || exit 1
;;
- https://*|http://*|ftp://*)
+ yes,https://*|yes,http://*|yes,ftp://*)
case "$depth" in
"") ;;
*) die "shallow over http or ftp not supported" ;;
diff --git a/git-fetch.sh b/git-fetch.sh
index e169848..84c2523 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -237,11 +237,31 @@ fetch_all_at_once () {
}
+http_fetch () {
+ if [ -n "$GIT_SSL_NO_VERIFY" ]; then
+ curl_extra_args="-k"
+ fi
+ if [ -n "$GIT_CURL_FTP_NO_EPSV" -o \
+ "`git-config --bool http.noEPSV`" = true ]; then
+ curl_extra_args="${curl_extra_args} --disable-epsv"
+ fi
+
+ # $1 = Remote, $2 = Local
+ curl -nsfL $curl_extra_args "$1" >"$2"
+}
+
fetch_per_ref () {
reflist="$1"
refs=
rref=
+ if test -n "$all"; then
+ reflist=$(canon_refs_list_for_fetch -d "$remote_nick" \
+ "+refs/heads/*:refs/remotes/$remote_nick/*")
+ http_fetch "$remote/HEAD" "$GIT_DIR/REMOTE_HEAD" ||
+ rm -f "$GIT_DIR/REMOTE_HEAD"
+ fi
+
for ref in $reflist
do
refs="$refs$LF$ref"
--
1.5.2.rc3.783.gc7476-dirty