Last active
August 4, 2018 13:33
-
-
Save srz-zumix/aacd0a389e751f0334bd7e299f23dae0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| err=0 | |
| # untracked な .meta ファイルを列挙 | |
| for METAFILE in `git clean -n -e meta | cut -f 3 -d " " | grep -o ".*\.meta"`; do | |
| # .meta を含んだパスが METAFILE に入る | |
| FILE=${METAFILE%.meta} | |
| # .meta を除いたパスが FILE に入る | |
| # FILE が存在し、git 管理下の場合警告 | |
| if [ -f "$FILE" ]; then | |
| if [ ! -z "`git log -1 --oneline $FILE`" ]; then | |
| # 過去にバージョン管理されたが、現在は管理外の場合がある | |
| if [ -z "`git clean -nd | cut -f 3 -d " " | grep -v .meta | grep -o "$FILE/\{0,1\}$"`" ]; then | |
| echo "$FILE" | |
| err=1 | |
| fi | |
| fi | |
| fi | |
| done | |
| if [ $err -ne 0 ]; then | |
| echo | |
| echo .meta ファイルが commit されてません | |
| echo $'\e[1;31mPUSH FAILED.\e[m' | |
| exit 1 | |
| fi | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment