diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2020-04-24 20:54:33 -0600 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2020-04-24 20:54:33 -0600 |
commit | c197ad40f1dca62fd1e0e555e7bfc84e39f31223 (patch) | |
tree | 5c1e753e0ff2cb9d0e08a699f17352225b9ef9f1 /tools/upgrade.sh | |
parent | 0b67340fd2fe9330d8487491e1983ad1a111fb2b (diff) | |
parent | 2560f04982dfc2693221c7c0f47d1a71df09a794 (diff) | |
download | zsh-c197ad40f1dca62fd1e0e555e7bfc84e39f31223.tar.gz zsh-c197ad40f1dca62fd1e0e555e7bfc84e39f31223.tar.bz2 zsh-c197ad40f1dca62fd1e0e555e7bfc84e39f31223.zip |
Merge branch 'master' of https://github.com/ohmyzsh/ohmyzsh
Diffstat (limited to 'tools/upgrade.sh')
-rw-r--r-- | tools/upgrade.sh | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 0dc84e214..10f816080 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -1,23 +1,20 @@ # Use colors, but only if connected to a terminal, and that terminal # supports them. -if which tput >/dev/null 2>&1; then - ncolors=$(tput colors) -fi -if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then - RED="$(tput setaf 1)" - GREEN="$(tput setaf 2)" - YELLOW="$(tput setaf 3)" - BLUE="$(tput setaf 4)" - BOLD="$(tput bold)" - NORMAL="$(tput sgr0)" +if [ -t 1 ]; then + RED=$(printf '\033[31m') + GREEN=$(printf '\033[32m') + YELLOW=$(printf '\033[33m') + BLUE=$(printf '\033[34m') + BOLD=$(printf '\033[1m') + RESET=$(printf '\033[m') else RED="" GREEN="" YELLOW="" BLUE="" BOLD="" - NORMAL="" + RESET="" fi cd "$ZSH" @@ -30,6 +27,9 @@ git config core.autocrlf false git config fsck.zeroPaddedFilemode ignore git config fetch.fsck.zeroPaddedFilemode ignore git config receive.fsck.zeroPaddedFilemode ignore +# autostash on rebase (#7172) +resetAutoStash=$(git config --bool rebase.autoStash 2>&1) +git config rebase.autoStash true # Update upstream remote to ohmyzsh org remote=$(git remote -v | awk '/https:\/\/github\.com\/robbyrussell\/oh-my-zsh\.git/{ print $1; exit }') @@ -38,7 +38,7 @@ if [ -n "$remote" ]; then fi printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh" -if git pull --rebase --autostash --stat origin master +if git pull --rebase --stat origin master then printf '%s' "$GREEN" printf '%s\n' ' __ __ ' @@ -48,8 +48,14 @@ then printf '%s\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' printf '%s\n' ' /____/ ' printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version." - printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh" - printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh" + printf "${BLUE}${BOLD}%s${RESET}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh" + printf "${BLUE}${BOLD}%s${RESET}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh" else - printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?' + printf "${RED}%s${RESET}\n" 'There was an error updating. Try again later?' fi + +# Unset git-config values set just for the upgrade +case "$resetAutoStash" in + "") git config --unset rebase.autoStash ;; + *) git config rebase.autoStash "$resetAutoStash" ;; +esac |