aboutsummaryrefslogtreecommitdiff
path: root/git-clone.sh
diff options
context:
space:
mode:
authorRamsay Allan Jones <ramsay@ramsay1.demon.co.uk>2006-07-29 17:12:34 +0100
committerJunio C Hamano <junkio@cox.net>2006-08-02 00:27:17 -0700
commit6ebdee5af47df0c64354e452419015a694c25f5f (patch)
treef12a8dd72ec0ec1ec410665423abf05f4b82fb5d /git-clone.sh
parentbc9e1b8483b16d117d2f868f96e354be2a678d52 (diff)
downloadgit-6ebdee5af47df0c64354e452419015a694c25f5f.tar.gz
git-6ebdee5af47df0c64354e452419015a694c25f5f.tar.xz
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>
Diffstat (limited to 'git-clone.sh')
-rwxr-xr-xgit-clone.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/git-clone.sh b/git-clone.sh
index a92b22a13..acc7a51b9 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -205,7 +205,7 @@ dir="$2"
[ -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,8 @@ test -d "$GIT_DIR/refs/reference-tmp" && rm -fr "$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
fi
cd "$D" || exit