Skip to content

Commit

Permalink
Add multiple file use checks; fix sed pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
brikabrak committed Aug 20, 2018
1 parent c6ad422 commit 288e8c2
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions unity-git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,25 @@ fi

# Mac Only!
LFS_INSTALL="$(brew list git-lfs | grep bin/git-lfs )"
echo $LFS_INSTALL
if [[ $LFS_INSTALL = "Error*" || ! -f $LFS_INSTALL ]]; then
echo "No git lfs, installing via brew..."
brew install git-lfs
fi

curl -o .gitignore https://raw.githubusercontent.com/github/gitignore/master/Unity.gitignore
if [ ! -f ".gitignore" ]; then
curl -o .gitignore https://raw.githubusercontent.com/github/gitignore/master/Unity.gitignore
fi

echo $'*.psd\n*.png\n*.mp3\n*.wav\n*.prefab\n*.fbx\n*.xcf\n*.blend\n*.obj\n*.3ds\n*.dae' > .gitattributes
sed -e 's/\(\*\.\w\+\)/\1 filter=lfs diff=lfs merge=lfs -text\n/' .gitattributes > a.tmp && mv a.tmp .gitattributes
sed -e 's/\(\*\.[a-zA-Z0-9]*\)/\1 filter=lfs diff=lfs merge=lfs -text/' .gitattributes > a.tmp && mv a.tmp .gitattributes

printf $'[merge]\ntool = unityyamlmerge\n\n[mergetool "unityyamlmerge"]\ntrustExitCode = false\ncmd = \'' > .gitconfig && printf "$TOOL_PATH" >> .gitconfig && printf $'\' "$BASE" "$REMOTE" "$LOCAL" "$MERGED"\n' >> .gitconfig
if [ ! -f ".gitconfig" ]; then
printf $'[merge]\ntool = unityyamlmerge\n\n[mergetool "unityyamlmerge"]\ntrustExitCode = false\ncmd = \'' > .gitconfig && printf "$TOOL_PATH" >> .gitconfig && printf $'\' "$BASE" "$REMOTE" "$LOCAL" "$MERGED"\n' >> .gitconfig
fi

git init
if [ ! -d ".git" ]; then
git init
fi
git lfs install

echo "~~Finished git setup for Unity~~~"
Expand Down

0 comments on commit 288e8c2

Please sign in to comment.