From 14b4f62e65b3d94c275ea8892f252deae9ce619a Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 29 Feb 2020 14:53:06 +0100 Subject: updater: fix --autostash argument. Works for git > 1.7.1 See https://github.com/ohmyzsh/ohmyzsh/pull/7172#issuecomment-592875226 --- tools/upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 0dc84e214..9ecaed2ef 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -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 -c rebase.autoStash=true pull --rebase --stat origin master then printf '%s' "$GREEN" printf '%s\n' ' __ __ ' -- cgit v1.2.3-70-g09d2 From 6ba2d9de3d85408e6d9ebc32a00a4df2194693e1 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 11 Mar 2020 14:17:41 +0100 Subject: updater: use `git config` instead of `git -c` for git < v1.7.2 Fixes #8732 --- tools/upgrade.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 9ecaed2ef..6d0a46637 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -30,6 +30,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 +41,7 @@ if [ -n "$remote" ]; then fi printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh" -if git -c rebase.autoStash=true pull --rebase --stat origin master +if git pull --rebase --stat origin master then printf '%s' "$GREEN" printf '%s\n' ' __ __ ' @@ -53,3 +56,9 @@ then else printf "${RED}%s${NORMAL}\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 -- cgit v1.2.3-70-g09d2 From 27f4e079329dabf8e7008b98c8bddf443116eb54 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 11 Mar 2020 14:24:04 +0100 Subject: updater: use hardcoded color sequences instead of tput --- tools/upgrade.sh | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'tools') diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 6d0a46637..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" @@ -51,10 +48,10 @@ 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 -- cgit v1.2.3-70-g09d2