]> asedeno.scripts.mit.edu Git - git.git/blobdiff - git-clone.sh
commit: allow --amend to reuse message from another commit
[git.git] / git-clone.sh
index 24ad179bbda69ecf68e49896c3c018425b645461..68085a3225cb0047ab3c5764472d3d024e467160 100755 (executable)
@@ -205,7 +205,10 @@ fi
 # it is local
 if base=$(get_repo_base "$repo"); then
        repo="$base"
-       local=yes
+       if test -z "$depth"
+       then
+               local=yes
+       fi
 fi
 
 dir="$2"
@@ -229,7 +232,7 @@ cleanup() {
 trap cleanup 0
 mkdir -p "$dir" && D=$(cd "$dir" && pwd) || usage
 test -n "$GIT_WORK_TREE" && mkdir -p "$GIT_WORK_TREE" &&
-W=$(cd "$GIT_WORK_TREE" && pwd) && export GIT_WORK_TREE="$W"
+W=$(cd "$GIT_WORK_TREE" && pwd) && GIT_WORK_TREE="$W" && export GIT_WORK_TREE
 if test yes = "$bare" || test -n "$GIT_WORK_TREE"; then
        GIT_DIR="$D"
 else
@@ -297,7 +300,8 @@ yes)
                                      find objects -type f -print | sed -e 1q)
                        # objects directory should not be empty because
                        # we are cloning!
-                       test -f "$repo/$sample_file" || exit
+                       test -f "$repo/$sample_file" ||
+                               die "fatal: cannot clone empty repository"
                        if ln "$repo/$sample_file" "$GIT_DIR/objects/sample" 2>/dev/null
                        then
                                rm -f "$GIT_DIR/objects/sample"