]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
setup.sh removes the remote if fetching was unsuccessful.
authorSimon Ruderich <simon@ruderich.org>
Sat, 21 Feb 2009 23:03:36 +0000 (17:03 -0600)
committerSimon Ruderich <simon@ruderich.org>
Sat, 21 Feb 2009 23:03:36 +0000 (17:03 -0600)
This makes fixing the remote easier as it's not necessary to remove it before
trying to add it again.

setup.sh

index 8bb651c8f83c50ebf0a4b621b072e730484b4d61..e18d62c0f95197712c9fe6eeb98e265b288fb523 100755 (executable)
--- a/setup.sh
+++ b/setup.sh
@@ -28,6 +28,11 @@ 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.
+        if [ "$?" -ne "0" ]; then
+            git remote rm "$2"
+        fi
+
         # Pushing to the remote pushes only the master branch in remotes named
         # the hostname of this machine. This makes it easy to see where
         # changes came from.