War on whitespace
[gitweb.git] / git-clone.sh
index de51983584bb0fd015ed75704b72bec8fdb55430..5bfd8d1556bb7d0da0beaf3685b2350af20e1e15 100755 (executable)
@@ -2,7 +2,7 @@
 #
 # Copyright (c) 2005, Linus Torvalds
 # Copyright (c) 2005, Junio C Hamano
-# 
+#
 # Clone a repository into a different directory that does not yet exist.
 
 # See git-sh-setup why.
@@ -18,7 +18,14 @@ usage() {
 }
 
 get_repo_base() {
-       (cd "$1" && (cd .git ; pwd)) 2> /dev/null
+       (
+               cd "`/bin/pwd`" &&
+               cd "$1" &&
+               {
+                       cd .git
+                       pwd
+               }
+       ) 2>/dev/null
 }
 
 if [ -n "$GIT_SSL_NO_VERIFY" ]; then
@@ -42,6 +49,7 @@ clone_dumb_http () {
        http_fetch "$1/info/refs" "$clone_tmp/refs" ||
                die "Cannot get remote repository information.
 Perhaps git-update-server-info needs to be run there?"
+       test "z$quiet" = z && v=-v || v=
        while read sha1 refname
        do
                name=`expr "z$refname" : 'zrefs/\(.*\)'` &&
@@ -59,7 +67,7 @@ Perhaps git-update-server-info needs to be run there?"
                else
                        tname=$name
                fi
-               git-http-fetch -v -a -w "$tname" "$name" "$1/" || exit 1
+               git-http-fetch $v -a -w "$tname" "$sha1" "$1" || exit 1
        done <"$clone_tmp/refs"
        rm -fr "$clone_tmp"
        http_fetch "$1/HEAD" "$GIT_DIR/REMOTE_HEAD" ||
@@ -90,7 +98,7 @@ while
        *,--na|*,--nak|*,--nake|*,--naked|\
        *,-b|*,--b|*,--ba|*,--bar|*,--bare) bare=yes ;;
        *,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local) use_local=yes ;;
-        *,-s|*,--s|*,--sh|*,--sha|*,--shar|*,--share|*,--shared) 
+        *,-s|*,--s|*,--sh|*,--sha|*,--shar|*,--share|*,--shared)
           local_shared=yes; use_local=yes ;;
        1,--template) usage ;;
        *,--template)
@@ -402,4 +410,3 @@ fi
 rm -f "$GIT_DIR/CLONE_HEAD" "$GIT_DIR/REMOTE_HEAD"
 
 trap - 0
-