From 41ff7a1076e9282535f77ddfb4e23a95354009fd Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 17 Feb 2006 13:33:24 -0800 Subject: Trap exit to clean up created directory if clone fails. Signed-off-by: Carl Worth Signed-off-by: Junio C Hamano --- git-clone.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/git-clone.sh b/git-clone.sh index e192b08c0..d184ceb7a 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 + -- cgit v1.2.1