From ad3a88cfd34aeed5ed69b4056e393580a686fb09 Mon Sep 17 00:00:00 2001 From: randx Date: Wed, 29 Aug 2012 02:03:04 +0300 Subject: [PATCH] Prepared for gitolite v3 --- app/models/merge_request.rb | 2 +- app/roles/push_event.rb | 2 ++ config/gitlab.yml.example | 4 ++-- doc/installation.md | 15 +++++++++------ lib/gitlab/merge.rb | 3 +-- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 542817b0eea..2e457f72286 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -162,7 +162,7 @@ class MergeRequest < ActiveRecord::Base end def automerge!(current_user) - if Gitlab::Merge.new(self, current_user).merge + if Gitlab::Merge.new(self, current_user).merge && self.unmerged_commits.empty? self.merge!(current_user.id) true end diff --git a/app/roles/push_event.rb b/app/roles/push_event.rb index ff8e28a2db2..a607f212f2a 100644 --- a/app/roles/push_event.rb +++ b/app/roles/push_event.rb @@ -90,6 +90,8 @@ module PushEvent def push_with_commits? md_ref? && commits.any? && parent_commit && last_commit + rescue Grit::NoSuchPathError + false end def last_push_to_non_root? diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index d05cc1bead6..77b818bade5 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -33,11 +33,11 @@ app: git_host: admin_uri: git@localhost:gitolite-admin base_path: /home/git/repositories/ - # hooks_path: /var/lib/gitolite/.gitolite/hooks/ # only needed when gitolite is not installed according the manual - # host: localhost + hooks_path: /home/git/.gitolite/hooks/ git_user: git upload_pack: true receive_pack: true + # host: localhost # port: 22 # Git settings diff --git a/doc/installation.md b/doc/installation.md index e14ec711e7b..af169d81c6f 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -113,17 +113,20 @@ Generate key: Clone GitLab's fork of the Gitolite source code: cd /home/git - sudo -H -u git git clone https://github.com/gitlabhq/gitolite.git /home/git/gitolite + sudo -H -u git git clone -b gl-v304 https://github.com/gitlabhq/gitolite.git /home/git/gitolite Setup: + cd /home/git + sudo -u git -H mkdir bin sudo -u git sh -c 'echo -e "PATH=\$PATH:/home/git/bin\nexport PATH" >> /home/git/.profile' - sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; /home/git/gitolite/src/gl-system-install" + sudo -u git sh -c 'gitolite/install -ln /home/git/bin' + sudo cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub sudo chmod 0444 /home/git/gitlab.pub - sudo -u git -H sed -i 's/0077/0007/g' /home/git/share/gitolite/conf/example.gitolite.rc - sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; gl-setup -q /home/git/gitlab.pub" + sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; gitolite setup -pk /home/git/gitlab.pub" + sudo -u git -H sed -i 's/0077/0007/g' /home/git/.gitolite.rc Permissions: @@ -189,8 +192,8 @@ and ensure you have followed all of the above steps carefully. #### Setup GitLab hooks - sudo cp ./lib/hooks/post-receive /home/git/share/gitolite/hooks/common/post-receive - sudo chown git:git /home/git/share/gitolite/hooks/common/post-receive + sudo cp ./lib/hooks/post-receive /home/git/.gitolite/hooks/common/post-receive + sudo chown git:git /home/git/.gitolite/hooks/common/post-receive #### Check application status diff --git a/lib/gitlab/merge.rb b/lib/gitlab/merge.rb index 134695ce21c..180135745f8 100644 --- a/lib/gitlab/merge.rb +++ b/lib/gitlab/merge.rb @@ -21,8 +21,7 @@ module Gitlab if output =~ /CONFLICT/ false else - repo.git.push({}, "origin", merge_request.target_branch) - true + !!repo.git.push({}, "origin", merge_request.target_branch) end end end