]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
Abort if the fetch fails in setup.sh.
authorSimon Ruderich <simon@ruderich.org>
Sat, 21 Feb 2009 23:07:17 +0000 (17:07 -0600)
committerSimon Ruderich <simon@ruderich.org>
Sat, 21 Feb 2009 23:07:17 +0000 (17:07 -0600)
This prevents that the push rule is added multiple times to .git/config if a
fetch failed.

setup.sh

index 95aad803ea58989dd6d2b59b5a0a6063a124ac84..da3e9bde524c231dd235db7befd895062c324088 100755 (executable)
--- 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