Skip to content

Commit 3a8df34

Browse files
committed
Check if hook is installed, if not, install it. If python is available install the python version of the hook since it's faster.
1 parent 960b04e commit 3a8df34

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+330
-232
lines changed

app/controllers/gitolite_hook_controller.rb

Lines changed: 0 additions & 96 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
class GitoliteHooksController < SysController
3+
4+
def post_receive
5+
project = Project.find_by_identifier(params[:project_id])
6+
if project.nil?
7+
render(:text => "No project found with identifier '#{params[:project_id]}'") if project.nil?
8+
return
9+
end
10+
11+
# If for some reason we need to properly support the hook, we will also need to get
12+
# the refs that are beeing updated.
13+
#
14+
# For that, un-comment bellow.
15+
#
16+
#GitHosting.logger.info "Refs: #{params[:refs]}"
17+
#params[:refs].each {|ref|
18+
# old, new, refname = ref.split(',')
19+
# GitHosting.logger.info "Ref: OLD=>#{old} NEW=>#{new} REFNAME=>#{refname}"
20+
#} if not params[:refs].nil?
21+
22+
Repository.fetch_changesets_for_project(params[:project_id])
23+
render(:text => 'OK')
24+
end
25+
26+
end

app/views/settings/_redmine_git_hosting.html.erb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,11 @@
7474
<%= select_tag("settings[gitPostUpdateHookCurlIgnore]", options_for_select([[l(:label_enabled), 'true'], [l(:label_disabled), 'false']], @settings['gitPostUpdateHookCurlIgnore'])) %>
7575
<br />
7676
</p>
77+
<p>
78+
<label><%= l(:label_hook_installed)%></label>
79+
<%= image_tag((GitHosting::Hooks::GitAdapterHooks.check_hooks_installed==true ? 'true.png' : 'exclamation.png'), :style => "vertical-align:bottom;") %>
80+
<em><%= (GitHosting::Hooks::GitAdapterHooks.check_hooks_installed==true ? '' : GitHosting::Hooks::GitAdapterHooks.check_hooks_installed) %></em>
81+
<br />
82+
</p>
7783
<br/>
7884
</div>

config/locales/bg.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
label_git_hook_header: Repository Hooks
2626
label_git_hook_debug: Run hooks in Debug mode
2727
label_git_hook_curl_security_ignore: Ignore curl security issues
28+
label_hook_installed: Hook installed
2829

2930
label_public_keys: Public keys
3031
label_public_key_new: New public key

config/locales/bs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
label_git_hook_header: Repository Hooks
2626
label_git_hook_debug: Run hooks in Debug mode
2727
label_git_hook_curl_security_ignore: Ignore curl security issues
28+
label_hook_installed: Hook installed
2829

2930
label_public_keys: Public keys
3031
label_public_key_new: New public key

config/locales/ca.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
label_git_hook_header: Repository Hooks
2626
label_git_hook_debug: Run hooks in Debug mode
2727
label_git_hook_curl_security_ignore: Ignore curl security issues
28+
label_hook_installed: Hook installed
2829

2930
label_public_keys: Public keys
3031
label_public_key_new: New public key

config/locales/cs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
label_git_hook_header: Repository Hooks
2626
label_git_hook_debug: Run hooks in Debug mode
2727
label_git_hook_curl_security_ignore: Ignore curl security issues
28+
label_hook_installed: Hook installed
2829

2930
label_public_keys: Public keys
3031
label_public_key_new: New public key

config/locales/da.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
label_sudo_web_to_git_user: Web user is able to sudo to Git user?
2020
label_sudo_git_to_web_user: Git user is able to sudo to Web user?
2121

22+
label_logging: Enable Logging
23+
label_logging_warning: This might have a performance penalty. Requires a server restart.
24+
2225
label_git_hook_header: Repository Hooks
2326
label_git_hook_debug: Run hooks in Debug mode
2427
label_git_hook_curl_security_ignore: Ignore curl security issues
25-
26-
label_logging: Enable Logging
27-
label_logging_warning: This might have a performance penalty. Requires a server restart.
28+
label_hook_installed: Hook installed
2829

2930
label_public_keys: Public keys
3031
label_public_key_new: New public key

config/locales/de.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
label_sudo_web_to_git_user: Web user is able to sudo to Git user?
2020
label_sudo_git_to_web_user: Git user is able to sudo to Web user?
2121

22+
label_logging: Enable Logging
23+
label_logging_warning: This might have a performance penalty. Requires a server restart.
24+
2225
label_git_hook_header: Repository Hooks
2326
label_git_hook_debug: Run hooks in Debug mode
2427
label_git_hook_curl_security_ignore: Ignore curl security issues
25-
26-
label_logging: Enable Logging
27-
label_logging_warning: This might have a performance penalty. Requires a server restart.
28+
label_hook_installed: Hook installed
2829

2930
label_public_keys: Public keys
3031
label_public_key_new: New public key

config/locales/el.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
label_sudo_web_to_git_user: Web user is able to sudo to Git user?
2020
label_sudo_git_to_web_user: Git user is able to sudo to Web user?
2121

22+
label_logging: Enable Logging
23+
label_logging_warning: This might have a performance penalty. Requires a server restart.
24+
2225
label_git_hook_header: Repository Hooks
2326
label_git_hook_debug: Run hooks in Debug mode
2427
label_git_hook_curl_security_ignore: Ignore curl security issues
25-
26-
label_logging: Enable Logging
27-
label_logging_warning: This might have a performance penalty. Requires a server restart.
28+
label_hook_installed: Hook installed
2829

2930
label_public_keys: Public keys
3031
label_public_key_new: New public key

config/locales/en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
label_git_hook_header: Repository Hooks
2626
label_git_hook_debug: Run hooks in Debug mode
2727
label_git_hook_curl_security_ignore: Ignore curl security issues
28+
label_hook_installed: Hook installed
2829

2930
label_public_keys: Public keys
3031
label_public_key_new: New public key

config/locales/es.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
label_sudo_web_to_git_user: Web user is able to sudo to Git user?
2020
label_sudo_git_to_web_user: Git user is able to sudo to Web user?
2121

22+
label_logging: Enable Logging
23+
label_logging_warning: This might have a performance penalty. Requires a server restart.
24+
2225
label_git_hook_header: Repository Hooks
2326
label_git_hook_debug: Run hooks in Debug mode
2427
label_git_hook_curl_security_ignore: Ignore curl security issues
25-
26-
label_logging: Enable Logging
27-
label_logging_warning: This might have a performance penalty. Requires a server restart.
28+
label_hook_installed: Hook installed
2829

2930
label_public_keys: Public keys
3031
label_public_key_new: New public key

config/locales/fi.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
label_sudo_web_to_git_user: Web user is able to sudo to Git user?
2020
label_sudo_git_to_web_user: Git user is able to sudo to Web user?
2121

22+
label_logging: Enable Logging
23+
label_logging_warning: This might have a performance penalty. Requires a server restart.
24+
2225
label_git_hook_header: Repository Hooks
2326
label_git_hook_debug: Run hooks in Debug mode
2427
label_git_hook_curl_security_ignore: Ignore curl security issues
25-
26-
label_logging: Enable Logging
27-
label_logging_warning: This might have a performance penalty. Requires a server restart.
28+
label_hook_installed: Hook installed
2829

2930
label_public_keys: Public keys
3031
label_public_key_new: New public key

config/locales/fr.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
label_sudo_web_to_git_user: Web user is able to sudo to Git user?
2020
label_sudo_git_to_web_user: Git user is able to sudo to Web user?
2121

22+
label_logging: Enable Logging
23+
label_logging_warning: This might have a performance penalty. Requires a server restart.
24+
2225
label_git_hook_header: Repository Hooks
2326
label_git_hook_debug: Run hooks in Debug mode
2427
label_git_hook_curl_security_ignore: Ignore curl security issues
25-
26-
label_logging: Enable Logging
27-
label_logging_warning: This might have a performance penalty. Requires a server restart.
28+
label_hook_installed: Hook installed
2829

2930
label_public_keys: Public keys
3031
label_public_key_new: New public key

config/locales/gl.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
label_sudo_web_to_git_user: Web user is able to sudo to Git user?
2020
label_sudo_git_to_web_user: Git user is able to sudo to Web user?
2121

22+
label_logging: Enable Logging
23+
label_logging_warning: This might have a performance penalty. Requires a server restart.
24+
2225
label_git_hook_header: Repository Hooks
2326
label_git_hook_debug: Run hooks in Debug mode
2427
label_git_hook_curl_security_ignore: Ignore curl security issues
25-
26-
label_logging: Enable Logging
27-
label_logging_warning: This might have a performance penalty. Requires a server restart.
28+
label_hook_installed: Hook installed
2829

2930
label_public_keys: Public keys
3031
label_public_key_new: New public key

config/locales/he.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
label_sudo_web_to_git_user: Web user is able to sudo to Git user?
2020
label_sudo_git_to_web_user: Git user is able to sudo to Web user?
2121

22+
label_logging: Enable Logging
23+
label_logging_warning: This might have a performance penalty. Requires a server restart.
24+
2225
label_git_hook_header: Repository Hooks
2326
label_git_hook_debug: Run hooks in Debug mode
2427
label_git_hook_curl_security_ignore: Ignore curl security issues
25-
26-
label_logging: Enable Logging
27-
label_logging_warning: This might have a performance penalty. Requires a server restart.
28+
label_hook_installed: Hook installed
2829

2930
label_public_keys: Public keys
3031
label_public_key_new: New public key

config/locales/hu.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
label_sudo_web_to_git_user: Web user is able to sudo to Git user?
2020
label_sudo_git_to_web_user: Git user is able to sudo to Web user?
2121

22+
label_logging: Enable Logging
23+
label_logging_warning: This might have a performance penalty. Requires a server restart.
24+
2225
label_git_hook_header: Repository Hooks
2326
label_git_hook_debug: Run hooks in Debug mode
2427
label_git_hook_curl_security_ignore: Ignore curl security issues
25-
26-
label_logging: Enable Logging
27-
label_logging_warning: This might have a performance penalty. Requires a server restart.
28+
label_hook_installed: Hook installed
2829

2930
label_public_keys: Public keys
3031
label_public_key_new: New public key

config/locales/id.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
label_sudo_web_to_git_user: Web user is able to sudo to Git user?
2020
label_sudo_git_to_web_user: Git user is able to sudo to Web user?
2121

22+
label_logging: Enable Logging
23+
label_logging_warning: This might have a performance penalty. Requires a server restart.
24+
2225
label_git_hook_header: Repository Hooks
2326
label_git_hook_debug: Run hooks in Debug mode
2427
label_git_hook_curl_security_ignore: Ignore curl security issues
25-
26-
label_logging: Enable Logging
27-
label_logging_warning: This might have a performance penalty. Requires a server restart.
28+
label_hook_installed: Hook installed
2829

2930
label_public_keys: Public keys
3031
label_public_key_new: New public key

config/locales/it.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
label_sudo_web_to_git_user: Web user is able to sudo to Git user?
2020
label_sudo_git_to_web_user: Git user is able to sudo to Web user?
2121

22+
label_logging: Enable Logging
23+
label_logging_warning: This might have a performance penalty. Requires a server restart.
24+
2225
label_git_hook_header: Repository Hooks
2326
label_git_hook_debug: Run hooks in Debug mode
2427
label_git_hook_curl_security_ignore: Ignore curl security issues
25-
26-
label_logging: Enable Logging
27-
label_logging_warning: This might have a performance penalty. Requires a server restart.
28+
label_hook_installed: Hook installed
2829

2930
label_public_keys: Public keys
3031
label_public_key_new: New public key

config/locales/ja.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
label_sudo_web_to_git_user: Web user is able to sudo to Git user?
2020
label_sudo_git_to_web_user: Git user is able to sudo to Web user?
2121

22+
label_logging: Enable Logging
23+
label_logging_warning: This might have a performance penalty. Requires a server restart.
24+
2225
label_git_hook_header: Repository Hooks
2326
label_git_hook_debug: Run hooks in Debug mode
2427
label_git_hook_curl_security_ignore: Ignore curl security issues
25-
26-
label_logging: Enable Logging
27-
label_logging_warning: This might have a performance penalty. Requires a server restart.
28+
label_hook_installed: Hook installed
2829

2930
label_public_keys: Public keys
3031
label_public_key_new: New public key

config/locales/ko.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
label_sudo_web_to_git_user: Web user is able to sudo to Git user?
2020
label_sudo_git_to_web_user: Git user is able to sudo to Web user?
2121

22+
label_logging: Enable Logging
23+
label_logging_warning: This might have a performance penalty. Requires a server restart.
24+
2225
label_git_hook_header: Repository Hooks
2326
label_git_hook_debug: Run hooks in Debug mode
2427
label_git_hook_curl_security_ignore: Ignore curl security issues
25-
26-
label_logging: Enable Logging
27-
label_logging_warning: This might have a performance penalty. Requires a server restart.
28+
label_hook_installed: Hook installed
2829

2930
label_public_keys: Public keys
3031
label_public_key_new: New public key

0 commit comments

Comments
 (0)