X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-clone.sh;h=3998c55cef3658eda18817d513a5bd5003c30e89;hb=1974bf620b436b014bfe86179ff76485610a4887;hp=de59904d56155faecedbd7cd4818a741dde43ffd;hpb=0a2586c807fadc4b13a741e693471765870f6bb4;p=git.git diff --git a/git-clone.sh b/git-clone.sh index de59904d5..3998c55ce 100755 --- a/git-clone.sh +++ b/git-clone.sh @@ -29,8 +29,12 @@ http_fetch () { clone_dumb_http () { # $1 - remote, $2 - local cd "$2" && - clone_tmp='.git/clone-tmp' && + clone_tmp="$GIT_DIR/clone-tmp" && mkdir -p "$clone_tmp" || exit 1 + if [ -n "$GIT_CURL_FTP_NO_EPSV" -o \ + "`git-repo-config --bool http.noEPSV`" = true ]; then + curl_extra_args="${curl_extra_args} --disable-epsv" + fi http_fetch "$1/info/refs" "$clone_tmp/refs" || { echo >&2 "Cannot get remote repository information. Perhaps git-update-server-info needs to be run there?" @@ -133,7 +137,7 @@ while *,--reference) shift; reference="$1" ;; *,--reference=*) - reference=`expr "$1" : '--reference=\(.*\)'` ;; + reference=`expr "z$1" : 'z--reference=\(.*\)'` ;; *,-o|*,--or|*,--ori|*,--orig|*,--origi|*,--origin) case "$2" in '') @@ -205,17 +209,13 @@ dir="$2" [ -e "$dir" ] && echo "$dir already exists." && usage mkdir -p "$dir" && D=$(cd "$dir" && pwd) && -trap 'err=$?; cd ..; rm -r "$D"; exit $err' 0 -case "$bare" in -yes) GIT_DIR="$D" ;; -*) GIT_DIR="$D/.git" ;; -esac && export GIT_DIR && git-init-db ${template+"$template"} || usage +trap 'err=$?; cd ..; rm -rf "$D"; exit $err' 0 case "$bare" in yes) GIT_DIR="$D" ;; *) GIT_DIR="$D/.git" ;; -esac +esac && export GIT_DIR && git-init-db ${template+"$template"} || usage if test -n "$reference" then @@ -270,7 +270,7 @@ yes,yes) echo "$repo/objects" >> "$GIT_DIR/objects/info/alternates" ;; esac - git-ls-remote "$repo" >"$GIT_DIR/CLONE_HEAD" + git-ls-remote "$repo" >"$GIT_DIR/CLONE_HEAD" || exit 1 ;; *) case "$repo" in @@ -300,9 +300,9 @@ yes,yes) done rm -f "$GIT_DIR/TMP_ALT" fi - git-ls-remote "$repo" >"$GIT_DIR/CLONE_HEAD" + git-ls-remote "$repo" >"$GIT_DIR/CLONE_HEAD" || exit 1 ;; - http://*) + https://*|http://*|ftp://*) if test -z "@@NO_CURL@@" then clone_dumb_http "$repo" "$D" @@ -328,7 +328,8 @@ test -d "$GIT_DIR/refs/reference-tmp" && rm -fr "$GIT_DIR/refs/reference-tmp" if test -f "$GIT_DIR/CLONE_HEAD" then # Read git-fetch-pack -k output and store the remote branches. - perl -e "$copy_refs" "$GIT_DIR" "$use_separate_remote" "$origin" + @@PERL@@ -e "$copy_refs" "$GIT_DIR" "$use_separate_remote" "$origin" || + exit fi cd "$D" || exit @@ -391,11 +392,16 @@ Pull: refs/heads/$head_points_at:$origin_track" && (cd "$GIT_DIR/$remote_top" && find . -type f -print) | while read dotslref do - name=`expr "$dotslref" : './\(.*\)'` && - test "$use_separate_remote" = '' && { - test "$head_points_at" = "$name" || - test "$origin" = "$name" - } || + name=`expr "$dotslref" : './\(.*\)'` + if test "z$head_points_at" = "z$name" + then + continue + fi + if test "$use_separate_remote" = '' && + test "z$origin" = "z$name" + then + continue + fi echo "Pull: refs/heads/${name}:$remote_top/${name}" done >>"$GIT_DIR/remotes/$origin" && case "$use_separate_remote" in