6ba2d9de3d85408e6d9ebc32a00a4df2194693e1
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
updater: use `git config` instead of `git -c` for git < v1.7.2
Fixes #8732
Diff
1diff --git a/tools/upgrade.sh b/tools/upgrade.sh
2index 9ecaed2ef80bfd3b5709b143da999dd899ade1ad..6d0a4663701afa7f0a477ac2a3002f4b61dd33e6 100644
3--- a/tools/upgrade.sh
4+++ b/tools/upgrade.sh
5@@ -30,6 +30,9 @@ git config core.autocrlf false
6 git config fsck.zeroPaddedFilemode ignore
7 git config fetch.fsck.zeroPaddedFilemode ignore
8 git config receive.fsck.zeroPaddedFilemode ignore
9+# autostash on rebase (#7172)
10+resetAutoStash=$(git config --bool rebase.autoStash 2>&1)
11+git config rebase.autoStash true
12
13 # Update upstream remote to ohmyzsh org
14 remote=$(git remote -v | awk '/https:\/\/github\.com\/robbyrussell\/oh-my-zsh\.git/{ print $1; exit }')
15@@ -38,7 +41,7 @@ if [ -n "$remote" ]; then
16 fi
17
18 printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh"
19-if git -c rebase.autoStash=true pull --rebase --stat origin master
20+if git pull --rebase --stat origin master
21 then
22 printf '%s' "$GREEN"
23 printf '%s\n' ' __ __ '
24@@ -53,3 +56,9 @@ then
25 else
26 printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?'
27 fi
28+
29+# Unset git-config values set just for the upgrade
30+case "$resetAutoStash" in
31+ "") git config --unset rebase.autoStash ;;
32+ *) git config rebase.autoStash "$resetAutoStash" ;;
33+esac