summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8960b5a)
raw | patch | inline | side by side (parent: 8960b5a)
author | Matthias Lederhofer <matled@gmx.net> | |
Thu, 5 Jul 2007 22:54:33 +0000 (00:54 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 6 Jul 2007 05:52:44 +0000 (22:52 -0700) |
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-clone.sh | patch | blob | history |
diff --git a/git-clone.sh b/git-clone.sh
index 48dafa21cf9efef957739408c78ba4ab47494f13..4ca91009dd72ea2adc757b11f386cc4d4441eb38 100755 (executable)
--- a/git-clone.sh
+++ b/git-clone.sh
# 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."
-mkdir -p "$dir" &&
-D=$(cd "$dir" && pwd) &&
-trap 'err=$?; cd ..; rm -rf "$D"; exit $err' 0
+D=
+cleanup() {
+ err=$?
+ test -z "$D" && rm -rf "$dir"
+ cd ..
+ test -n "$D" && rm -rf "$D"
+ exit $err
+}
+trap cleanup 0
+mkdir -p "$dir" && D=$(cd "$dir" && pwd) || usage
case "$bare" in
yes)
GIT_DIR="$D" ;;
*)
GIT_DIR="$D/.git" ;;
-esac && export GIT_DIR && git init $quiet ${template+"$template"} || usage
+esac &&
+export GIT_DIR &&
+git-init $quiet ${template+"$template"} || usage
if test -n "$reference"
then