Code

Update the gitweb/README file to include setting the GITWEB_CONFIG environment
[git.git] / git-fetch.sh
index 0c7a11d5658e29dcf1036afb4db4020226b8e033..f1522bd49a2fc1c3106c6b2ed0a38af0a9ff72de 100755 (executable)
@@ -20,6 +20,7 @@ verbose=
 update_head_ok=
 exec=
 upload_pack=
+keep=--thin
 while case "$#" in 0) break ;; esac
 do
        case "$1" in
@@ -67,10 +68,10 @@ done
 
 case "$#" in
 0)
-       test -f "$GIT_DIR/branches/origin" ||
-               test -f "$GIT_DIR/remotes/origin" ||
-                       die "Where do you want to fetch from today?"
-       set origin ;;
+       origin=$(get_default_remote)
+       test -n "$(get_remote_url ${origin})" ||
+               die "Where do you want to fetch from today?"
+       set x $origin ; shift ;;
 esac
 
 remote_nick="$1"
@@ -153,7 +154,7 @@ fast_forward_local () {
        then
                if now_=$(cat "$GIT_DIR/$1") && test "$now_" = "$2"
                then
-                       [ "$verbose" ] && echo >&2 "* $1: same as $3"
+                       [ "$verbose" ] && echo >&2 "* $1: same as $3" ||:
                else
                        echo >&2 "* $1: updating with $3"
                        git-update-ref -m "$rloga: updating tag" "$1" "$2"
@@ -256,6 +257,7 @@ fi
 fetch_main () {
   reflist="$1"
   refs=
+  rref=
 
   for ref in $reflist
   do
@@ -284,10 +286,14 @@ fetch_main () {
 
       # There are transports that can fetch only one head at a time...
       case "$remote" in
-      http://* | https://*)
+      http://* | https://* | ftp://*)
          if [ -n "$GIT_SSL_NO_VERIFY" ]; then
              curl_extra_args="-k"
          fi
+         if [ -n "$GIT_CURL_FTP_NO_EPSV" -o \
+               "`git-repo-config --bool http.noEPSV`" = true ]; then
+             noepsv_opt="--disable-epsv"
+         fi
          max_depth=5
          depth=0
          head="ref: $remote_name"
@@ -299,7 +305,7 @@ fetch_main () {
              $u =~ s{([^-a-zA-Z0-9/.])}{sprintf"%%%02x",ord($1)}eg;
              print "$u";
          ' "$head")
-           head=$(curl -nsfL $curl_extra_args "$remote/$remote_name_quoted")
+           head=$(curl -nsfL $curl_extra_args $noepsv_opt "$remote/$remote_name_quoted")
            depth=$( expr \( $depth + 1 \) )
          done
          expr "z$head" : "z$_x40\$" >/dev/null ||
@@ -348,13 +354,13 @@ fetch_main () {
   done
 
   case "$remote" in
-  http://* | https://* | rsync://* )
+  http://* | https://* | ftp://* | rsync://* )
       ;; # we are already done.
   *)
     ( : subshell because we muck with IFS
       IFS="    $LF"
       (
-         git-fetch-pack $exec $keep --thin "$remote" $rref || echo failed "$remote"
+         git-fetch-pack $exec $keep "$remote" $rref || echo failed "$remote"
       ) |
       while read sha1 remote_name
       do