summaryrefslogtreecommitdiff
path: root/git-clone.sh
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2006-02-17 13:33:24 -0800
committerJunio C Hamano <junkio@cox.net>2006-02-17 16:16:49 -0800
commit41ff7a1076e9282535f77ddfb4e23a95354009fd (patch)
tree4147eaba6994a88158151f688a03822f04a19833 /git-clone.sh
parentbabfaf8dee0baa09c56d1a2ec5623b60d900518b (diff)
downloadgit-41ff7a1076e9282535f77ddfb4e23a95354009fd.tar.gz
Trap exit to clean up created directory if clone fails.
Signed-off-by: Carl Worth <cworth@cworth.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-clone.sh')
-rwxr-xr-xgit-clone.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/git-clone.sh b/git-clone.sh
index e192b08c0d..d184ceb7a6 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -118,6 +118,7 @@ dir="$2"
[ -e "$dir" ] && echo "$dir already exists." && usage
mkdir -p "$dir" &&
D=$(cd "$dir" && pwd) &&
+trap 'err=$?; rm -r $D; exit $err' exit
case "$bare" in
yes) GIT_DIR="$D" ;;
*) GIT_DIR="$D/.git" ;;
@@ -255,3 +256,6 @@ Pull: $head_points_at:$origin" &&
git checkout
esac
fi
+
+trap - exit
+