Always clone over HTTPS, and bail out immediately if Git fails

This commit is contained in:
Danielle McLean 2016-10-04 08:33:22 +11:00
parent 4046d20569
commit b185a2c79b
No known key found for this signature in database
GPG key ID: CC91589719027E94

View file

@ -4,18 +4,18 @@ bootstrap() {
echo 'Bootstrapping your dotfiles...' >&2 echo 'Bootstrapping your dotfiles...' >&2
if ! hash stow 2>/dev/null; then if ! hash stow 2>/dev/null; then
echo 'GNU Stow is not installed, fetching it...' >&2 echo 'GNU Stow is not installed, fetching it...' >&2
clone stow clone stow || return $?
STOW=$DOTFILES/stow/.local/bin/stow STOW=$DOTFILES/stow/.local/bin/stow
fi fi
mkdir -p ~/.zsh && touch ~/.zsh/zhistory mkdir -p ~/.zsh && touch ~/.zsh/zhistory
clone dot vim zsh clone dot vim zsh || return $?
link link
} }
clone() { clone() {
for package in $argv; do for package in $argv; do
clone-one $package clone-one $package || return $?
done done
} }
@ -23,7 +23,7 @@ clone-one() {
local url=$1 local url=$1
local package=${${url##*/}%.git} local package=${${url##*/}%.git}
# Simple package names are fetched from my GitHub repos. # Simple package names are fetched from my GitHub repos.
[[ $url != */* ]] && url=git@github.com:$GITHUB_USER/dot-$package [[ $url != */* ]] && url=$GITHUB_USER/dot-$package
# user/repo packages are fetched from that user's repos. # user/repo packages are fetched from that user's repos.
[[ $url != *:* ]] && url=https://github.com/$url [[ $url != *:* ]] && url=https://github.com/$url
mkdir -p $DOTFILES mkdir -p $DOTFILES