Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
276ca427
Commit
276ca427
authored
Jul 22, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Remove source-branch for MRs from same project
parent
95d89e44
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
3 deletions
+12
-3
CHANGELOG
CHANGELOG
+1
-0
app/models/merge_request.rb
app/models/merge_request.rb
+4
-0
app/services/files/base_service.rb
app/services/files/base_service.rb
+1
-1
app/services/merge_requests/auto_merge_service.rb
app/services/merge_requests/auto_merge_service.rb
+5
-1
lib/gitlab/satellite/merge_action.rb
lib/gitlab/satellite/merge_action.rb
+1
-1
No files found.
CHANGELOG
View file @
276ca427
...
@@ -11,6 +11,7 @@ v 7.14.0 (unreleased)
...
@@ -11,6 +11,7 @@ v 7.14.0 (unreleased)
- Expire Rails cache entries after two weeks to prevent endless Redis growth
- Expire Rails cache entries after two weeks to prevent endless Redis growth
- Add support for destroying project milestones (Stan Hu)
- Add support for destroying project milestones (Stan Hu)
- Add fetch command to the MR page.
- Add fetch command to the MR page.
- Fix bug causing "Remove source-branch" option not to work for merge requests from the same project.
v 7.13.0 (unreleased)
v 7.13.0 (unreleased)
- 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)
...
...
app/models/merge_request.rb
View file @
276ca427
...
@@ -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
...
...
app/services/files/base_service.rb
View file @
276ca427
...
@@ -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
...
...
app/services/merge_requests/auto_merge_service.rb
View file @
276ca427
...
@@ -37,6 +37,10 @@ module MergeRequests
...
@@ -37,6 +37,10 @@ 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
end
end
end
end
end
end
...
@@ -55,7 +59,7 @@ module MergeRequests
...
@@ -55,7 +59,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
...
...
lib/gitlab/satellite/merge_action.rb
View file @
276ca427
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment