File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -199,6 +199,9 @@ def hash_content(content)
199199 #
200200 def content_from_redmine_side ( file )
201201 File . read ( file )
202+ rescue Errno ::ENOENT => e
203+ logger . error ( e . message )
204+ ''
202205 end
203206
204207
Original file line number Diff line number Diff line change @@ -112,7 +112,14 @@ def file_exists?
112112
113113 def install_hook_file
114114 logger . info ( "Installing hook '#{ source_path } ' in '#{ destination_path } '" )
115- RedmineGitHosting ::Commands . sudo_install_file ( File . read ( source_path ) , destination_path , filemode )
115+ begin
116+ content = File . read ( source_path )
117+ rescue Errno ::ENOENT => e
118+ logger . error ( "Errors while installing hook '#{ e . message } '" )
119+ return false
120+ else
121+ RedmineGitHosting ::Commands . sudo_install_file ( content , destination_path , filemode )
122+ end
116123 end
117124
118125
You can’t perform that action at this time.
0 commit comments