Commit ad2bd193 authored by Valery Sizov's avatar Valery Sizov

Merge branch 'update-7-13-stable' into '7-13-stable'

Update 7-13-stable (7.13.1)



See merge request !1033
parents 53ab8440 494c672e
...@@ -7,6 +7,8 @@ v 7.13.1 ...@@ -7,6 +7,8 @@ v 7.13.1
- Improve documentation - Improve documentation
- Fix of migration: Check if session_expire_delay column exists before adding the column - Fix of migration: Check if session_expire_delay column exists before adding the column
- Fix: ActionView::Template::Error - Fix: ActionView::Template::Error
- Fix: "Create Merge Request" isn't always shown in event for newly pushed branch
- Fix bug causing "Remove source-branch" option not to work for merge requests from the same project.
v 7.13.0 v 7.13.0
- Remove repository graph log to fix slow cache updates after push event (Stan Hu) - Remove repository graph log to fix slow cache updates after push event (Stan Hu)
......
...@@ -235,6 +235,10 @@ class MergeRequest < ActiveRecord::Base ...@@ -235,6 +235,10 @@ class MergeRequest < ActiveRecord::Base
execute(self, commit_message) execute(self, commit_message)
end end
def remove_source_branch?
self.should_remove_source_branch && !self.source_project.root_ref?(self.source_branch) && !self.for_fork?
end
def open? def open?
opened? || reopened? opened? || reopened?
end end
......
...@@ -39,7 +39,7 @@ module Files ...@@ -39,7 +39,7 @@ module Files
def after_commit(sha, branch) def after_commit(sha, branch)
commit = repository.commit(sha) commit = repository.commit(sha)
full_ref = 'refs/heads/' + branch full_ref = "#{Gitlab::Git::BRANCH_REF_PREFIX}#{branch}"
old_sha = commit.parent_id || Gitlab::Git::BLANK_SHA old_sha = commit.parent_id || Gitlab::Git::BLANK_SHA
GitPushService.new.execute(project, current_user, old_sha, sha, full_ref) GitPushService.new.execute(project, current_user, old_sha, sha, full_ref)
end end
......
...@@ -37,6 +37,14 @@ module MergeRequests ...@@ -37,6 +37,14 @@ module MergeRequests
# Merge local branches using rugged instead of satellites # Merge local branches using rugged instead of satellites
if sha = commit if sha = commit
after_commit(sha, merge_request.target_branch) after_commit(sha, merge_request.target_branch)
if merge_request.remove_source_branch?
DeleteBranchService.new(merge_request.source_project, current_user).execute(merge_request.source_branch)
end
true
else
false
end end
end end
end end
...@@ -55,7 +63,7 @@ module MergeRequests ...@@ -55,7 +63,7 @@ module MergeRequests
def after_commit(sha, branch) def after_commit(sha, branch)
commit = repository.commit(sha) commit = repository.commit(sha)
full_ref = 'refs/heads/' + branch full_ref = "#{Gitlab::Git::BRANCH_REF_PREFIX}#{branch}"
old_sha = commit.parent_id || Gitlab::Git::BLANK_SHA old_sha = commit.parent_id || Gitlab::Git::BLANK_SHA
GitPushService.new.execute(project, current_user, old_sha, sha, full_ref) GitPushService.new.execute(project, current_user, old_sha, sha, full_ref)
end end
......
...@@ -33,7 +33,7 @@ module Gitlab ...@@ -33,7 +33,7 @@ module Gitlab
merge_repo.git.push(default_options, :origin, merge_request.target_branch) merge_repo.git.push(default_options, :origin, merge_request.target_branch)
# remove source branch # remove source branch
if merge_request.should_remove_source_branch && !project.root_ref?(merge_request.source_branch) && !merge_request.for_fork? if merge_request.remove_source_branch?
# will raise CommandFailed when push fails # will raise CommandFailed when push fails
merge_repo.git.push(default_options, :origin, ":#{merge_request.source_branch}") merge_repo.git.push(default_options, :origin, ":#{merge_request.source_branch}")
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment