Commit ad3a88cfd34aeed5ed69b4056e393580a686fb09

Authored by randx
1 parent 1f5e2658

Prepared for gitolite v3

app/models/merge_request.rb
@@ -162,7 +162,7 @@ class MergeRequest < ActiveRecord::Base @@ -162,7 +162,7 @@ class MergeRequest < ActiveRecord::Base
162 end 162 end
163 163
164 def automerge!(current_user) 164 def automerge!(current_user)
165 - if Gitlab::Merge.new(self, current_user).merge 165 + if Gitlab::Merge.new(self, current_user).merge && self.unmerged_commits.empty?
166 self.merge!(current_user.id) 166 self.merge!(current_user.id)
167 true 167 true
168 end 168 end
app/roles/push_event.rb
@@ -90,6 +90,8 @@ module PushEvent @@ -90,6 +90,8 @@ module PushEvent
90 90
91 def push_with_commits? 91 def push_with_commits?
92 md_ref? && commits.any? && parent_commit && last_commit 92 md_ref? && commits.any? && parent_commit && last_commit
  93 + rescue Grit::NoSuchPathError
  94 + false
93 end 95 end
94 96
95 def last_push_to_non_root? 97 def last_push_to_non_root?
config/gitlab.yml.example
@@ -33,11 +33,11 @@ app: @@ -33,11 +33,11 @@ app:
33 git_host: 33 git_host:
34 admin_uri: git@localhost:gitolite-admin 34 admin_uri: git@localhost:gitolite-admin
35 base_path: /home/git/repositories/ 35 base_path: /home/git/repositories/
36 - # hooks_path: /var/lib/gitolite/.gitolite/hooks/ # only needed when gitolite is not installed according the manual  
37 - # host: localhost 36 + hooks_path: /home/git/.gitolite/hooks/
38 git_user: git 37 git_user: git
39 upload_pack: true 38 upload_pack: true
40 receive_pack: true 39 receive_pack: true
  40 + # host: localhost
41 # port: 22 41 # port: 22
42 42
43 # Git settings 43 # Git settings
doc/installation.md
@@ -113,17 +113,20 @@ Generate key: @@ -113,17 +113,20 @@ Generate key:
113 Clone GitLab's fork of the Gitolite source code: 113 Clone GitLab's fork of the Gitolite source code:
114 114
115 cd /home/git 115 cd /home/git
116 - sudo -H -u git git clone https://github.com/gitlabhq/gitolite.git /home/git/gitolite 116 + sudo -H -u git git clone -b gl-v304 https://github.com/gitlabhq/gitolite.git /home/git/gitolite
117 117
118 Setup: 118 Setup:
119 119
  120 + cd /home/git
  121 + sudo -u git -H mkdir bin
120 sudo -u git sh -c 'echo -e "PATH=\$PATH:/home/git/bin\nexport PATH" >> /home/git/.profile' 122 sudo -u git sh -c 'echo -e "PATH=\$PATH:/home/git/bin\nexport PATH" >> /home/git/.profile'
121 - sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; /home/git/gitolite/src/gl-system-install" 123 + sudo -u git sh -c 'gitolite/install -ln /home/git/bin'
  124 +
122 sudo cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub 125 sudo cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub
123 sudo chmod 0444 /home/git/gitlab.pub 126 sudo chmod 0444 /home/git/gitlab.pub
124 127
125 - sudo -u git -H sed -i 's/0077/0007/g' /home/git/share/gitolite/conf/example.gitolite.rc  
126 - sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; gl-setup -q /home/git/gitlab.pub" 128 + sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; gitolite setup -pk /home/git/gitlab.pub"
  129 + sudo -u git -H sed -i 's/0077/0007/g' /home/git/.gitolite.rc
127 130
128 Permissions: 131 Permissions:
129 132
@@ -189,8 +192,8 @@ and ensure you have followed all of the above steps carefully. @@ -189,8 +192,8 @@ and ensure you have followed all of the above steps carefully.
189 192
190 #### Setup GitLab hooks 193 #### Setup GitLab hooks
191 194
192 - sudo cp ./lib/hooks/post-receive /home/git/share/gitolite/hooks/common/post-receive  
193 - sudo chown git:git /home/git/share/gitolite/hooks/common/post-receive 195 + sudo cp ./lib/hooks/post-receive /home/git/.gitolite/hooks/common/post-receive
  196 + sudo chown git:git /home/git/.gitolite/hooks/common/post-receive
194 197
195 #### Check application status 198 #### Check application status
196 199
lib/gitlab/merge.rb
@@ -21,8 +21,7 @@ module Gitlab @@ -21,8 +21,7 @@ module Gitlab
21 if output =~ /CONFLICT/ 21 if output =~ /CONFLICT/
22 false 22 false
23 else 23 else
24 - repo.git.push({}, "origin", merge_request.target_branch)  
25 - true 24 + !!repo.git.push({}, "origin", merge_request.target_branch)
26 end 25 end
27 end 26 end
28 end 27 end