@matheusbsbs / matheus-bagliano / commits / 41ff7a1076
Fork 0

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>

Carl Worth committed Feb 17, 2006 at 13:33 UTC 41ff7a1076e9282535f77ddfb4e23a95354009fd
1 file changed +4
git-clone.sh
+4
@@ -118,6 +118,7 @@ dir="$2"
118 [ -e "$dir" ] && echo "$dir already exists." && usage
119 mkdir -p "$dir" &&
120 D=$(cd "$dir" && pwd) &&
121 +trap 'err=$?; rm -r $D; exit $err' exit
122 case "$bare" in
123 yes) GIT_DIR="$D" ;;
124 *) GIT_DIR="$D/.git" ;;
@@ -255,3 +256,6 @@ Pull: $head_points_at:$origin" &&
256 git checkout
257 esac
258 fi
259 +
260 +trap - exit
261 +