Merge branch 'fixes'
[git.git] / git-fetch.sh
index 61da6a9..8fb6fba 100755 (executable)
@@ -49,7 +49,7 @@ rsync_slurped_objects=
 
 if test "" = "$append"
 then
-       : >$GIT_DIR/FETCH_HEAD
+       : >"$GIT_DIR/FETCH_HEAD"
 fi
 
 append_fetch_head () {
@@ -86,11 +86,11 @@ append_fetch_head () {
     if git-cat-file commit "$head_" >/dev/null 2>&1
     then
        headc_=$(git-rev-parse --verify "$head_^0") || exit
-       echo "$headc_   $not_for_merge_ $note_" >>$GIT_DIR/FETCH_HEAD
+       echo "$headc_   $not_for_merge_ $note_" >>"$GIT_DIR/FETCH_HEAD"
        echo >&2 "* committish: $head_"
        echo >&2 "  $note_"
     else
-       echo "$head_    not-for-merge   $note_" >>$GIT_DIR/FETCH_HEAD
+       echo "$head_    not-for-merge   $note_" >>"$GIT_DIR/FETCH_HEAD"
        echo >&2 "* non-commit: $head_"
        echo >&2 "  $note_"
     fi
@@ -170,7 +170,11 @@ esac
 reflist=$(get_remote_refs_for_fetch "$@")
 if test "$tags"
 then
-       taglist=$(git-ls-remote --tags "$remote" | awk '{ print "."$2":"$2 }')
+       taglist=$(git-ls-remote --tags "$remote" |
+               sed -e '
+                       /\^{}$/d
+                       s/^[^   ]*      //
+                       s/.*/&:&/')
        if test "$#" -gt 1
        then
                # remote URL plus explicit refspecs; we need to merge them.