From: Carl Worth Date: Fri, 17 Feb 2006 21:33:24 GMT Subject: [PATCH 1/3] Trap exit to clean up created directory if clone fails. Message-ID: <11402120042011-git-send-email-cworth@cworth.org> In-Reply-To: <11402120031687-git-send-email-cworth@cworth.org> Signed-off-by: Carl Worth --- git-clone.sh | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) 589b68168e3dad89238b879b06680c662a99ad8d diff --git a/git-clone.sh b/git-clone.sh index e192b08..d184ceb 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 + -- 1.2.0.gf6e8