@matheusbsbs / matheus-bagliano / commits / 6ebdee5af4
Fork 0

Ensure git-clone exits with error if perl script fails.

This helps tests 5400,5600,5700,5710 "fail correctly" rather than give some false positives. Also ensure cleanup actions in exit trap work correctly even if user has alias rm='rm -i'. Signed-off-by: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <junkio@cox.net>

Ramsay Allan Jones committed Jul 29, 2006 at 17:12 UTC 6ebdee5af47df0c64354e452419015a694c25f5f
1 file changed +3 -2
git-clone.sh
+3 -2
@@ -205,7 +205,7 @@ dir="$2"
205 [ -e "$dir" ] && echo "$dir already exists." && usage
206 mkdir -p "$dir" &&
207 D=$(cd "$dir" && pwd) &&
208 -trap 'err=$?; cd ..; rm -r "$D"; exit $err' 0
208 +trap 'err=$?; cd ..; rm -rf "$D"; exit $err' 0
209 case "$bare" in
210 yes)
211 GIT_DIR="$D" ;;
@@ -324,7 +324,8 @@ test -d "$GIT_DIR/refs/reference-tmp" && rm -fr "$GIT_DIR/refs/reference-tmp"
324 if test -f "$GIT_DIR/CLONE_HEAD"
325 then
326 # Read git-fetch-pack -k output and store the remote branches.
327 - @@PERL@@ -e "$copy_refs" "$GIT_DIR" "$use_separate_remote" "$origin"
327 + @@PERL@@ -e "$copy_refs" "$GIT_DIR" "$use_separate_remote" "$origin" ||
328 + exit
329 fi
330
331 cd "$D" || exit