Skip to content

Commit

Permalink
Ensure git-clone exits with error if perl script fails.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ramsay Allan Jones authored and Junio C Hamano committed Aug 2, 2006
1 parent bc9e1b8 commit 6ebdee5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions git-clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" ;;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6ebdee5

Please sign in to comment.