Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom temp folder #147

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/views/settings/_redmine_git_hosting.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
<%= text_field_tag("settings[gitRepositoryBasePath]", @settings['gitRepositoryBasePath'], :size => 60) %>
<br />
</p>
<p>
<label><%= l(:label_git_repository_tmp_dir)%></label>
<%= text_field_tag("settings[gitTmpDir]", @settings['gitTmpDir'], :size => 60) %>
<br />
</p>


<h3><%= l(:label_git_cache_parameters)%></h3>
Expand Down
1 change: 1 addition & 0 deletions config/locales/bg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/bs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/da.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/el.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/fi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/gl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/he.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/hu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/id.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/ko.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/lt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/no.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/pl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pt-BR:
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Ficheiro de identidade SSH Gitolite (Chave Privada)
label_git_repository_base_path: 'Directório Git base (Relativo à "home" do utilizador git)'
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/pt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pt:
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Ficheiro de identidade SSH Gitolite (Chave Privada)
label_git_repository_base_path: 'Directório Git base (Relativo à "home" do utilizador git)'
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/ro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/sk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/sl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/sr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/sv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/th.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/tr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/uk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/vi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/zh-TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
1 change: 1 addition & 0 deletions config/locales/zh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_repository_tmp_dir: Git temporary folder (leave empty to use the default one)

field_git_daemon: Git Daemon
field_git_http: Git Smart HTTP
Expand Down
3 changes: 2 additions & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
'gitCacheMaxElements' => '100',
'gitCacheMaxSize' => '16',
'gitHooksDebug' => 'false',
'gitHooksAreAsynchronous' => 'true'
'gitHooksAreAsynchronous' => 'true',
'gitTmpDir' => '' # Leave empty to use Dir.tmpdir as usual
},
:partial => 'redmine_git_hosting'
project_module :repository do
Expand Down
2 changes: 1 addition & 1 deletion lib/git_adapter_hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class GitAdapterHooks
@@check_hooks_installed_cached = nil

def self.check_hooks_installed
if not @@check_hooks_installed_cached.nil? and (Time.new - @@check_hooks_installed_stamp <= 0.5):
if not @@check_hooks_installed_cached.nil? and (Time.new - @@check_hooks_installed_stamp <= 0.5)
return @@check_hooks_installed_cached
end

Expand Down
6 changes: 4 additions & 2 deletions lib/git_hosting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def self.mirror_push_public_key
@@sudo_git_to_web_user_stamp = nil
@@sudo_git_to_web_user_cached = nil
def self.sudo_git_to_web_user
if not @@sudo_git_to_web_user_cached.nil? and (Time.new - @@sudo_git_to_web_user_stamp <= 0.5):
if not @@sudo_git_to_web_user_cached.nil? and (Time.new - @@sudo_git_to_web_user_stamp <= 0.5)
return @@sudo_git_to_web_user_cached
end
logger.info "Testing if git user(\"#{git_user}\") can sudo to web user(\"#{web_user}\")"
Expand All @@ -83,7 +83,7 @@ def self.sudo_git_to_web_user
@@sudo_web_to_git_user_stamp = nil
@@sudo_web_to_git_user_cached = nil
def self.sudo_web_to_git_user
if not @@sudo_web_to_git_user_cached.nil? and (Time.new - @@sudo_web_to_git_user_stamp <= 0.5):
if not @@sudo_web_to_git_user_cached.nil? and (Time.new - @@sudo_web_to_git_user_stamp <= 0.5)
return @@sudo_web_to_git_user_cached
end
logger.info "Testing if web user(\"#{web_user}\") can sudo to git user(\"#{git_user}\")"
Expand Down Expand Up @@ -146,6 +146,8 @@ def self.add_route_for_project_with_map(p,m)
end
end
def self.get_tmp_dir
tmp_dir = Setting.plugin_redmine_git_hosting['gitTmpDir']
@@git_hosting_tmp_dir = (tmp_dir.nil? || tmp_dir.strip.empty?) ? nil : File.join(tmp_dir, "redmine_git_hosting")
@@git_hosting_tmp_dir ||= File.join(Dir.tmpdir, "redmine_git_hosting")
if !File.directory?(@@git_hosting_tmp_dir)
%x[mkdir -p "#{@@git_hosting_tmp_dir}"]
Expand Down