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
Tatuya Kamada
gitlab-ce
Commits
358501df
Commit
358501df
authored
Jan 06, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly fix the edge case!
parent
a4b97b2c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
app/controllers/concerns/creates_commit.rb
app/controllers/concerns/creates_commit.rb
+15
-2
No files found.
app/controllers/concerns/creates_commit.rb
View file @
358501df
...
...
@@ -97,8 +97,6 @@ module CreatesCommit
# TODO: We should really clean this up
def
set_commit_variables
@mr_source_branch
=
@target_branch
unless
create_merge_request?
if
can?
(
current_user
,
:push_code
,
@project
)
# Edit file in this project
@tree_edit_project
=
@project
...
...
@@ -121,10 +119,25 @@ module CreatesCommit
@mr_target_project
=
@project
@mr_target_branch
=
@ref
||
@target_branch
end
@mr_source_branch
=
guess_mr_source_branch
end
def
initial_commit?
@mr_target_branch
.
nil?
||
!
@mr_target_project
.
repository
.
branch_exists?
(
@mr_target_branch
)
end
def
guess_mr_source_branch
# XXX: Happens when viewing a commit without a branch. In this case,
# @target_branch would be the default branch for @mr_source_project,
# however we want a generated new branch here. Thus we can't use
# @target_branch, but should pass nil to indicate that we want a new
# branch instead of @target_branch.
return
if
create_merge_request?
&&
@mr_source_project
.
repository
.
branch_exists?
(
@target_branch
)
@target_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