diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-19 13:58:36 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-19 13:58:36 +0400 |
commit | 569a88a456a5f01fbef6f5280b6982c3db8e2a72 (patch) | |
tree | 14a8f480a19ca1f194668fdc6ba48716c70d77e2 /lib | |
parent | 5c3fdfaacba50edbd6d6d7db65d2aa2e69bb5cad (diff) |
raise exception if gitolite is broken
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/backend/gitolite_config.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/gitlab/backend/gitolite_config.rb b/lib/gitlab/backend/gitolite_config.rb index 10e527eac73..720ef8d236b 100644 --- a/lib/gitlab/backend/gitolite_config.rb +++ b/lib/gitlab/backend/gitolite_config.rb @@ -6,6 +6,7 @@ module Gitlab class GitoliteConfig class PullError < StandardError; end class PushError < StandardError; end + class BrokenGitolite < StandardError; end attr_reader :config_tmp_dir, :ga_repo, :conf @@ -72,6 +73,10 @@ module Gitlab log("Push error -> " + " " + ex.message) raise Gitolite::AccessDenied, ex.message + rescue BrokenGitolite => ex + log("Gitolite error -> " + " " + ex.message) + raise Gitolite::AccessDenied, ex.message + rescue Exception => ex log(ex.class.name + " " + ex.message) raise Gitolite::AccessDenied.new("gitolite timeout") @@ -202,7 +207,15 @@ module Gitlab system('git commit -m "GitLab"') # git commit returns 0 on success, and 1 if there is nothing to commit raise "Git commit failed." unless [0,1].include? $?.exitstatus - if system('git push') + stdin, stdout, stderr = Open3.popen3('git push') + push_output = stderr.read + push_status = $?.to_i + + if push_output =~ /remote\: FATAL/ + raise BrokenGitolite, push_output + end + + if push_status.zero? Dir.chdir(Rails.root) else raise PushError, "unable to push gitolite-admin repo" |