File tree Expand file tree Collapse file tree 4 files changed +18
-6
lines changed
Expand file tree Collapse file tree 4 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -24,3 +24,11 @@ a team is collaborating on the same code base.
2424Copy files ` post-checkout ` ` post-merge ` and ` pre-commit ` to .git/hooks in your
2525git repository. If you also have hooks defined in these files, append them to
2626existing files.
27+
28+ It is assumed that Assets directory is located in the root directory of the
29+ repository. It can be configured using git config. Following example tells the
30+ scripts that the assets directory is ` client/Assets ` .
31+
32+ ```
33+ git config unity3d.assets-dir client/Assets
34+ ```
Original file line number Diff line number Diff line change 11#! /bin/sh
22
3+ ASSETS_DIR=" $( git config --get unity3d.assets-dir || echo " Assets" ) "
34# Remove empty assets directory
4- find Assets -depth -type d -empty -delete
5+ find " $ASSETS_DIR " -depth -type d -empty -delete
Original file line number Diff line number Diff line change 11#! /bin/sh
22
3+ ASSETS_DIR=" $( git config --get unity3d.assets-dir || echo " Assets" ) "
34# Remove empty assets directory
4- find Assets -depth -type d -empty -delete
5+ find " $ASSETS_DIR " -depth -type d -empty -delete
Original file line number Diff line number Diff line change 77#
88# To enable this hook, rename this file to "pre-commit".
99
10+ ASSETS_DIR=" $( git config --get unity3d.assets-dir || echo " Assets" ) "
11+
1012if git rev-parse --verify HEAD > /dev/null 2>&1
1113then
1214 against=HEAD
1820# Redirect output to stderr.
1921exec 1>&2
2022
21- git diff --cached --name-only --diff-filter=A -z $against -- Assets | while read -d $' \0' f; do
23+ git diff --cached --name-only --diff-filter=A -z $against -- " $ASSETS_DIR " | while read -d $' \0' f; do
2224 ext=" ${f##* .} "
2325 base=" ${f% .* } "
2426
3537fi
3638else
3739 p=" $f "
38- while [ " $p " != " Assets " ]; do
40+ while [ " $p " != " $ASSETS_DIR " ]; do
3941if [ $( git ls-files --cached -- " $p .meta" | wc -l) = 0 ]; then
4042 cat << EOF
4143Error: Missing meta file.
@@ -56,7 +58,7 @@ if [ "$ret" != 0 ]; then
5658exit " $ret "
5759fi
5860
59- git diff --cached --name-only --diff-filter=D -z $against -- Assets | while read -d $' \0' f; do
61+ git diff --cached --name-only --diff-filter=D -z $against -- " $ASSETS_DIR " | while read -d $' \0' f; do
6062 ext=" ${f##* .} "
6163 base=" ${f% .* } "
6264
7375fi
7476else
7577 p=" $f "
76- while [ " $p " != " Assets " ]; do
78+ while [ " $p " != " $ASSETS_DIR " ]; do
7779if [ $( git ls-files --cached -- " $p " | wc -l) = 0 ] && [ $( git ls-files --cached -- " $p .meta" | wc -l) != 0 ]; then
7880 cat << EOF
7981Error: Missing meta file.
You can’t perform that action at this time.
0 commit comments