From: Simon Ruderich Date: Sat, 21 Feb 2009 23:07:17 +0000 (-0600) Subject: Abort if the fetch fails in setup.sh. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=5a511574188e52137e66a73d1562ad0a1eac8067;p=config%2Fdotfiles.git Abort if the fetch fails in setup.sh. This prevents that the push rule is added multiple times to .git/config if a fetch failed. --- diff --git a/setup.sh b/setup.sh index 95aad80..da3e9bd 100755 --- a/setup.sh +++ b/setup.sh @@ -28,9 +28,10 @@ function git_remote_init_update() { echo "Adding remote '$2' to '$1'." git remote add -t master "$2" "$3/$1" git fetch "$2" > /dev/null - # Remove the remote if the fetch was unsuccessful. + # Remove the remote and abort if the fetch was unsuccessful. if [ "$?" -ne "0" ]; then git remote rm "$2" + exit 1 fi # Pushing to the remote pushes only the master branch in remotes named