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 2020 git_hook_path=" ../.git/hooks/$hook "
2121
2222 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} "
2425
2526 is_hook_linked=false
2627
2728 if test -f $git_hook_path ; then
2829 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
3031 is_hook_linked=true
3132 fi
3233 else
3637 fi
3738
3839 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
4047 echo " ${hook} is linked successfully."
4148 else
4249 echo " ${hook} is already linked."
You can’t perform that action at this time.
0 commit comments