summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2020-03-11 14:17:41 +0100
committerMarc Cornellà <marc.cornella@live.com>2020-03-11 14:28:15 +0100
commit6ba2d9de3d85408e6d9ebc32a00a4df2194693e1 (patch)
tree442dfe14b37bf2262d5a0a34bf43bf6da2001199
parent7900380239c6272b3bed4a16045c76bb8359a6ac (diff)
downloadzsh-6ba2d9de3d85408e6d9ebc32a00a4df2194693e1.tar.gz
zsh-6ba2d9de3d85408e6d9ebc32a00a4df2194693e1.tar.bz2
zsh-6ba2d9de3d85408e6d9ebc32a00a4df2194693e1.zip
updater: use `git config` instead of `git -c` for git < v1.7.2
Fixes #8732
-rw-r--r--tools/upgrade.sh11
1 files changed, 10 insertions, 1 deletions
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