From: Simon Ruderich Date: Sat, 21 Feb 2009 23:03:36 +0000 (-0600) Subject: setup.sh removes the remote if fetching was unsuccessful. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=b7ab75a41290728ec465f732d697f136186a4cef;p=config%2Fdotfiles.git setup.sh removes the remote if fetching was unsuccessful. This makes fixing the remote easier as it's not necessary to remove it before trying to add it again. --- diff --git a/setup.sh b/setup.sh index 8bb651c..e18d62c 100755 --- 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.