summaryrefslogtreecommitdiff
path: root/git-clone.sh
diff options
context:
space:
mode:
authorSanti Béjar <sbejar@gmail.com>2008-02-29 20:16:19 +0100
committerJunio C Hamano <gitster@pobox.com>2008-02-29 16:27:25 -0800
commitc6fef0bbea485ff8aec979177ee5c1c568fffc55 (patch)
tree8104d34c1bef858af7dd37311703c218cc8786ef /git-clone.sh
parent97b97c58e609a1cd23b3c2514f41cdb0405870ee (diff)
downloadgit-c6fef0bbea485ff8aec979177ee5c1c568fffc55.tar.gz
clone: support cloning full bundles
The "humanish" part of a bundle is made removing the ".bundle" suffix. Signed-off-by: Santi Béjar <sbejar@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-clone.sh')
-rwxr-xr-xgit-clone.sh37
1 files changed, 30 insertions, 7 deletions
diff --git a/git-clone.sh b/git-clone.sh
index 0d686c3a03..e981122778 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -210,11 +210,28 @@ if base=$(get_repo_base "$repo"); then
then
local=yes
fi
+elif test -f "$repo"
+then
+ case "$repo" in /*) ;; *) repo="$PWD/$repo" ;; esac
+fi
+
+# Decide the directory name of the new repository
+if test -n "$2"
+then
+ dir="$2"
+else
+ # Derive one from the repository name
+ # Try using "humanish" part of source repo if user didn't specify one
+ if test -f "$repo"
+ then
+ # Cloning from a bundle
+ dir=$(echo "$repo" | sed -e 's|/*\.bundle$||' -e 's|.*/||g')
+ else
+ dir=$(echo "$repo" |
+ sed -e 's|/$||' -e 's|:*/*\.git$||' -e 's|.*[/:]||g')
+ fi
fi
-dir="$2"
-# Try using "humanish" part of source repo if user didn't specify one
-[ -z "$dir" ] && dir=$(echo "$repo" | sed -e 's|/$||' -e 's|:*/*\.git$||' -e 's|.*[/:]||g')
[ -e "$dir" ] && die "destination directory '$dir' already exists."
[ yes = "$bare" ] && unset GIT_WORK_TREE
[ -n "$GIT_WORK_TREE" ] && [ -e "$GIT_WORK_TREE" ] &&
@@ -364,11 +381,17 @@ yes)
fi
;;
*)
- case "$upload_pack" in
- '') git-fetch-pack --all -k $quiet $depth $no_progress "$repo";;
- *) git-fetch-pack --all -k $quiet "$upload_pack" $depth $no_progress "$repo" ;;
- esac >"$GIT_DIR/CLONE_HEAD" ||
+ if [ -f "$repo" ] ; then
+ git bundle unbundle "$repo" > "$GIT_DIR/CLONE_HEAD" ||
+ die "unbundle from '$repo' failed."
+ else
+ case "$upload_pack" in
+ '') git-fetch-pack --all -k $quiet $depth $no_progress "$repo";;
+ *) git-fetch-pack --all -k \
+ $quiet "$upload_pack" $depth $no_progress "$repo" ;;
+ esac >"$GIT_DIR/CLONE_HEAD" ||
die "fetch-pack from '$repo' failed."
+ fi
;;
esac
;;