59c40eee8e9232f556e9d4c8c97eb1b866846af3

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

Message

fix(installer): avoid `git clone -c` to support git v1.7.1 (#10621)

Diff

 1diff --git a/tools/install.sh b/tools/install.sh
 2index 34dca841373832d96b6079ee540faa415c7fec90..2290bc1eb771c5a1c2534bde7a9926f2028f907e 100755
 3--- a/tools/install.sh
 4+++ b/tools/install.sh
 5@@ -263,13 +263,19 @@ setup_ohmyzsh() {
 6     exit 1
 7   fi
 8 
 9-  git clone -c core.eol=lf -c core.autocrlf=false \
10-    -c fsck.zeroPaddedFilemode=ignore \
11-    -c fetch.fsck.zeroPaddedFilemode=ignore \
12-    -c receive.fsck.zeroPaddedFilemode=ignore \
13-    -c oh-my-zsh.remote=origin \
14-    -c oh-my-zsh.branch="$BRANCH" \
15-    --depth=1 --branch "$BRANCH" "$REMOTE" "$ZSH" || {
16+  # Manual clone with git config options to support git < v1.7.2
17+  git init "$ZSH" && cd "$ZSH" \
18+  && git config core.eol lf \
19+  && git config core.autocrlf false \
20+  && git config fsck.zeroPaddedFilemode ignore \
21+  && git config fetch.fsck.zeroPaddedFilemode ignore \
22+  && git config receive.fsck.zeroPaddedFilemode ignore \
23+  && git config oh-my-zsh.remote origin \
24+  && git config oh-my-zsh.branch "$BRANCH" \
25+  && git remote add origin "$REMOTE" \
26+  && git fetch --depth=1 origin \
27+  && git checkout -b "$BRANCH" "origin/$BRANCH" || {
28+    rm -rf "$ZSH"
29     fmt_error "git clone of oh-my-zsh repo failed"
30     exit 1
31   }