File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 20
20
git_hook_path=" ../.git/hooks/$hook "
21
21
22
22
web3swift_hook_comment=" # web3swift git hook to perform actions like SwiftLint and codespell"
23
- web3swift_hook_path=" source $( pwd) /${hook} "
23
+ web3swift_hook_path=" $( pwd) /${hook} "
24
+ web3swift_hook_command=" source $( pwd) /${hook} "
24
25
25
26
is_hook_linked=false
26
27
27
28
if test -f $git_hook_path ; then
28
29
last_line=$( tac ${git_hook_path} | grep -m 1 -E ' [^[:space:]]' )
29
- if [ " $last_line " = " $web3swift_hook_path " ]; then
30
+ if [ " $last_line " = " $web3swift_hook_command " ]; then
30
31
is_hook_linked=true
31
32
fi
32
33
else
36
37
fi
37
38
38
39
if [ " $is_hook_linked " = false ] ; then
39
- echo " $web3swift_hook_path " >> $git_hook_path
40
+ cat << EOF >> $git_hook_path
41
+ web3swift_hook_path=${web3swift_hook_path}
42
+
43
+ if test -f \$ web3swift_hook_path; then
44
+ ${web3swift_hook_command}
45
+ fi
46
+ EOF
40
47
echo " ${hook} is linked successfully."
41
48
else
42
49
echo " ${hook} is already linked."
You can’t perform that action at this time.
0 commit comments