git-format-patch --start-number <n>
[git.git] / git-clone.sh
index c013e48..d96894d 100755 (executable)
@@ -38,12 +38,12 @@ Perhaps git-update-server-info needs to be run there?"
        }
        while read sha1 refname
        do
-               name=`expr "$refname" : 'refs/\(.*\)'` &&
+               name=`expr "z$refname" : 'zrefs/\(.*\)'` &&
                case "$name" in
                *^*)    continue;;
                esac
                if test -n "$use_separate_remote" &&
-                  branch_name=`expr "$name" : 'heads/\(.*\)'`
+                  branch_name=`expr "z$name" : 'zheads/\(.*\)'`
                then
                        tname="remotes/$origin/$branch_name"
                else
@@ -199,7 +199,7 @@ dir="$2"
 [ -e "$dir" ] && echo "$dir already exists." && usage
 mkdir -p "$dir" &&
 D=$(cd "$dir" && pwd) &&
-trap 'err=$?; cd ..; rm -r "$D"; exit $err' exit
+trap 'err=$?; cd ..; rm -r "$D"; exit $err' 0
 case "$bare" in
 yes) GIT_DIR="$D" ;;
 *) GIT_DIR="$D/.git" ;;
@@ -261,11 +261,7 @@ yes,yes)
            ;;
        yes)
            mkdir -p "$GIT_DIR/objects/info"
-           {
-               test -f "$repo/objects/info/alternates" &&
-               cat "$repo/objects/info/alternates";
-               echo "$repo/objects"
-           } >"$GIT_DIR/objects/info/alternates"
+           echo "$repo/objects" >> "$GIT_DIR/objects/info/alternates"
            ;;
        esac
        git-ls-remote "$repo" >"$GIT_DIR/CLONE_HEAD"
@@ -346,7 +342,7 @@ then
                # new style repository with a symref HEAD).
                # Ideally we should skip the guesswork but for now
                # opt for minimum change.
-               head_sha1=`expr "$head_sha1" : 'ref: refs/heads/\(.*\)'`
+               head_sha1=`expr "z$head_sha1" : 'zref: refs/heads/\(.*\)'`
                head_sha1=`cat "$GIT_DIR/$remote_top/$head_sha1"`
                ;;
        esac
@@ -411,5 +407,5 @@ Pull: refs/heads/$head_points_at:$origin_track" &&
 fi
 rm -f "$GIT_DIR/CLONE_HEAD" "$GIT_DIR/REMOTE_HEAD"
 
-trap - exit
+trap - 0