e3f7b8aa570a09186a7e3d1877b36d7e43d39197

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(updater): avoid `git -C` for compatibility with git < v1.8.5 (#10404)

Fixes #10404

Diff

 1diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
 2index 70cd21f8413ebb08571660500a6a19d607147378..a6fdf4659c7c7e991c3c6b4517554b7a7bb11cc3 100644
 3--- a/tools/check_for_upgrade.sh
 4+++ b/tools/check_for_upgrade.sh
 5@@ -34,11 +34,11 @@ function current_epoch() {
 6 
 7 function is_update_available() {
 8   local branch
 9-  branch=${"$(git -C "$ZSH" config --local oh-my-zsh.branch)":-master}
10+  branch=${"$(cd "$ZSH"; git config --local oh-my-zsh.branch)":-master}
11 
12   local remote remote_url remote_repo
13-  remote=${"$(git -C "$ZSH" config --local oh-my-zsh.remote)":-origin}
14-  remote_url=$(git -C "$ZSH" config remote.$remote.url)
15+  remote=${"$(cd "$ZSH"; git config --local oh-my-zsh.remote)":-origin}
16+  remote_url=$(cd "$ZSH"; git config remote.$remote.url)
17 
18   local repo
19   case "$remote_url" in
20@@ -56,7 +56,7 @@ function is_update_available() {
21 
22   # Get local HEAD. If this fails assume there are updates
23   local local_head
24-  local_head=$(git -C "$ZSH" rev-parse $branch 2>/dev/null) || return 0
25+  local_head=$(cd "$ZSH"; git rev-parse $branch 2>/dev/null) || return 0
26 
27   # Get remote HEAD. If no suitable command is found assume there are updates
28   # On any other error, skip the update (connection may be down)