1
0
mirror of https://github.com/git/git.git synced 2024-11-15 17:13:16 +01:00

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>
This commit is contained in:
Carl Worth 2006-02-17 13:33:24 -08:00 committed by Junio C Hamano
parent babfaf8dee
commit 41ff7a1076

@ -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