[PATCH 1/10] Ensure git-clone exits with error if perl script fails.

From: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date: 2006-08-02 11:03:16
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>
---
 git-clone.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-clone.sh b/git-clone.sh
index 6a14b25..47bd8e7 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -205,7 +205,7 @@ # Try using "humanish" part of source re
 [ -e "$dir" ] && echo "$dir already exists." && usage
 mkdir -p "$dir" &&
 D=$(cd "$dir" && pwd) &&
-trap 'err=$?; cd ..; rm -r "$D"; exit $err' 0
+trap 'err=$?; cd ..; rm -rf "$D"; exit $err' 0
 case "$bare" in
 yes)
 	GIT_DIR="$D" ;;
@@ -324,7 +324,7 @@ test -d "$GIT_DIR/refs/reference-tmp" &&
 if test -f "$GIT_DIR/CLONE_HEAD"
 then
 	# Read git-fetch-pack -k output and store the remote branches.
-	perl -e "$copy_refs" "$GIT_DIR" "$use_separate_remote" "$origin"
+	perl -e "$copy_refs" "$GIT_DIR" "$use_separate_remote" "$origin" || exit 1
 fi

 cd "$D" || exit
--
1.4.1


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Received on Wed Aug 02 11:03:36 2006

This archive was generated by hypermail 2.1.8 : 2006-08-02 11:05:36 EST