Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GDW-SS-18
to-the-surface
Commits
1296dbc3
Commit
1296dbc3
authored
Sep 24, 2018
by
Soraphis
Browse files
updated git hooks
parent
29dee7bd
Changes
3
Hide whitespace changes
Inline
Side-by-side
unity-git-hooks-master/scripts/post-checkout
View file @
1296dbc3
#!/bin/sh
ASSETS_DIR
=
"
$(
git config
--get
unity3d.assets-dir
||
echo
"Assets"
)
"
# Remove empty assets directory
find
"
$ASSETS_DIR
"
-depth
-type
d
-empty
-delete
find
Assets
-type
d
-empty
-prune
-exec
rm
-rf
{}
\;
\ No newline at end of file
unity-git-hooks-master/scripts/post-merge
View file @
1296dbc3
#!/bin/sh
ASSETS_DIR
=
"
$(
git config
--get
unity3d.assets-dir
||
echo
"Assets"
)
"
command
-v
git-lfs
>
/dev/null 2>&1
||
{
echo
>
&2
"
\n
This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-merge.
\n
"
;
exit
2
;
}
git lfs post-merge
"
$@
"
# Remove empty assets directory
find
"
$ASSETS_DIR
"
-depth
-type
d
-empty
-delete
find
Assets
-type
d
-empty
-prune
-exec
rm
-rf
{}
\;
\ No newline at end of file
unity-git-hooks-master/scripts/pre-commit
View file @
1296dbc3
...
...
@@ -7,8 +7,6 @@
#
# To enable this hook, rename this file to "pre-commit".
ASSETS_DIR
=
"
$(
git config
--get
unity3d.assets-dir
||
echo
"Assets"
)
"
if
git rev-parse
--verify
HEAD
>
/dev/null 2>&1
then
against
=
HEAD
...
...
@@ -20,7 +18,7 @@ fi
# Redirect output to stderr.
exec
1>&2
git diff
--cached
--name-only
--diff-filter
=
A
-z
$against
--
"
$ASSETS_DIR
"
|
while
read
-d
$'
\0
'
f
;
do
git diff
--cached
--name-only
--diff-filter
=
A
-z
$against
--
Assets
|
while
read
-d
$'
\0
'
f
;
do
ext
=
"
${
f
##*.
}
"
base
=
"
${
f
%.*
}
"
...
...
@@ -28,22 +26,18 @@ git diff --cached --name-only --diff-filter=A -z $against -- "$ASSETS_DIR" | whi
if
[
$(
git ls-files
--cached
--
"
$base
"
|
wc
-l
)
=
0
]
;
then
cat
<<
EOF
Error: Redudant meta file.
Meta file
\`
$f
' is added, but
\`
$base
' is not in the git index.
Please add
\`
$base
' to git as well.
EOF
exit
1
fi
else
p
=
"
$f
"
while
[
"
$p
"
!=
"
$ASSETS_DIR
"
]
;
do
while
[
"
$p
"
!=
"
Assets
"
]
;
do
if
[
$(
git ls-files
--cached
--
"
$p
.meta"
|
wc
-l
)
=
0
]
;
then
cat
<<
EOF
Error: Missing meta file.
Asset
\`
$f
' is added, but
\`
$p
.meta' is not in the git index.
Please add
\`
$p
.meta' to git as well.
EOF
exit
1
...
...
@@ -58,7 +52,7 @@ if [ "$ret" != 0 ]; then
exit
"
$ret
"
fi
git diff
--cached
--name-only
--diff-filter
=
D
-z
$against
--
"
$ASSETS_DIR
"
|
while
read
-d
$'
\0
'
f
;
do
git diff
--cached
--name-only
--diff-filter
=
D
-z
$against
--
Assets
|
while
read
-d
$'
\0
'
f
;
do
ext
=
"
${
f
##*.
}
"
base
=
"
${
f
%.*
}
"
...
...
@@ -66,22 +60,18 @@ git diff --cached --name-only --diff-filter=D -z $against -- "$ASSETS_DIR" | whi
if
[
$(
git ls-files
--cached
--
"
$base
"
|
wc
-l
)
!=
0
]
;
then
cat
<<
EOF
Error: Redudant meta file.
Meta file
\`
$f
' is removed, but
\`
$base
' is still in the git index.
Please remove
\`
$base
' from git as well.
EOF
exit
1
fi
else
p
=
"
$f
"
while
[
"
$p
"
!=
"
$ASSETS_DIR
"
]
;
do
while
[
"
$p
"
!=
"
Assets
"
]
;
do
if
[
$(
git ls-files
--cached
--
"
$p
"
|
wc
-l
)
=
0
]
&&
[
$(
git ls-files
--cached
--
"
$p
.meta"
|
wc
-l
)
!=
0
]
;
then
cat
<<
EOF
Error: Missing meta file.
Asset
\`
$f
' is removed, but
\`
$p
.meta' is still in the git index.
Please remove
\`
$p
.meta' from git as well.
EOF
exit
1
...
...
@@ -94,4 +84,4 @@ done
ret
=
"
$?
"
if
[
"
$ret
"
!=
0
]
;
then
exit
"
$ret
"
fi
fi
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment