]> asedeno.scripts.mit.edu Git - git.git/blobdiff - git-fetch.sh
Merge branch 'master' of git://repo.or.cz/git-gui
[git.git] / git-fetch.sh
index 87b940b85b5b128f29dc6084bb545640e5bf6b92..5ae0d28cc09a0b3935262a542c9811b66eb5b85e 100755 (executable)
@@ -22,9 +22,10 @@ force=
 verbose=
 update_head_ok=
 exec=
-upload_pack=
 keep=
 shallow_depth=
+no_progress=
+test -t 1 || no_progress=--no-progress
 while case "$#" in 0) break ;; esac
 do
        case "$1" in
@@ -34,8 +35,12 @@ do
        --upl|--uplo|--uploa|--upload|--upload-|--upload-p|\
        --upload-pa|--upload-pac|--upload-pack)
                shift
-               exec="--exec=$1" 
-               upload_pack="-u $1"
+               exec="--upload-pack=$1"
+               ;;
+       --upl=*|--uplo=*|--uploa=*|--upload=*|\
+       --upload-=*|--upload-p=*|--upload-pa=*|--upload-pac=*|--upload-pack=*)
+               exec=--upload-pack=$(expr "z$1" : 'z-[^=]*=\(.*\)')
+               shift
                ;;
        -f|--f|--fo|--for|--forc|--force)
                force=t
@@ -82,6 +87,12 @@ case "$#" in
        set x $origin ; shift ;;
 esac
 
+if test -z "$exec"
+then
+       # No command line override and we have configuration for the remote.
+       exec="--upload-pack=$(get_uploadpack $1)"
+fi
+
 remote_nick="$1"
 remote=$(get_remote_url "$@")
 refs=
@@ -94,7 +105,7 @@ then
 fi
 
 # Global that is reused later
-ls_remote_result=$(git ls-remote $upload_pack "$remote") ||
+ls_remote_result=$(git ls-remote $exec "$remote") ||
        die "Cannot get the repository state from $remote"
 
 append_fetch_head () {
@@ -234,6 +245,15 @@ then
        orig_head=$(git-rev-parse --verify HEAD 2>/dev/null)
 fi
 
+# Allow --notags from remote.$1.tagopt
+case "$tags$no_tags" in
+'')
+       case "$(git-config --get "remote.$1.tagopt")" in
+       --no-tags)
+               no_tags=t ;;
+       esac
+esac
+
 # If --tags (and later --heads or --all) is specified, then we are
 # not talking about defaults stored in Pull: line of remotes or
 # branches file, and just fetch those and refspecs explicitly given.
@@ -244,23 +264,10 @@ if test "$tags"
 then
        taglist=`IFS='  ' &&
                  echo "$ls_remote_result" |
+                 git-show-ref --exclude-existing=refs/tags/ |
                  while read sha1 name
                  do
-                       case "$sha1" in
-                       fail)
-                               exit 1
-                       esac
-                       case "$name" in
-                       *^*) continue ;;
-                       refs/tags/*) ;;
-                       *) continue ;;
-                       esac
-                       if git-check-ref-format "$name"
-                       then
-                           echo ".${name}:${name}"
-                       else
-                           echo >&2 "warning: tag ${name} ignored"
-                       fi
+                       echo ".${name}:${name}"
                  done` || exit
        if test "$#" -gt 1
        then
@@ -312,7 +319,7 @@ fetch_main () {
              curl_extra_args="-k"
          fi
          if [ -n "$GIT_CURL_FTP_NO_EPSV" -o \
-               "`git-repo-config --bool http.noEPSV`" = true ]; then
+               "`git-config --bool http.noEPSV`" = true ]; then
              noepsv_opt="--disable-epsv"
          fi
 
@@ -381,8 +388,16 @@ fetch_main () {
     ( : subshell because we muck with IFS
       IFS="    $LF"
       (
-         git-fetch-pack --thin $exec $keep $shallow_depth "$remote" $rref ||
+       if test -f "$remote" ; then
+           test -n "$shallow_depth" &&
+               die "shallow clone with bundle is not supported"
+           git-bundle unbundle "$remote" $rref ||
+           echo failed "$remote"
+       else
+         git-fetch-pack --thin $exec $keep $shallow_depth $no_progress \
+               "$remote" $rref ||
          echo failed "$remote"
+       fi
       ) |
       (
        trap '