diff --git a/git-clone.sh b/git-clone.sh
index cf410faaa38af6858dbe11ce7516bcd90c2882e3..dc0ad552a322d46f48bee2c8d324285a63a9b8c7 100755 (executable)
--- a/git-clone.sh
+++ b/git-clone.sh
[ -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" ;;
git checkout
esac
fi
+
+trap - exit
+