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
4d6e377c
Commit
4d6e377c
authored
Feb 24, 2017
by
Sanster
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix new MR form erroneously selects tag as source when branch of same name exists #23237
parent
6eeba4b1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
5 deletions
+38
-5
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+2
-2
changelogs/unreleased/fix-issue-23237.yml
changelogs/unreleased/fix-issue-23237.yml
+4
-0
spec/features/merge_requests/create_new_mr_spec.rb
spec/features/merge_requests/create_new_mr_spec.rb
+27
-0
spec/features/projects/compare_spec.rb
spec/features/projects/compare_spec.rb
+2
-1
spec/support/test_env.rb
spec/support/test_env.rb
+3
-2
No files found.
app/controllers/projects/merge_requests_controller.rb
100644 → 100755
View file @
4d6e377c
...
@@ -402,7 +402,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -402,7 +402,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
if
params
[
:ref
].
present?
if
params
[
:ref
].
present?
@ref
=
params
[
:ref
]
@ref
=
params
[
:ref
]
@commit
=
@repository
.
commit
(
@ref
)
@commit
=
@repository
.
commit
(
"refs/heads/
#{
@ref
}
"
)
end
end
render
layout:
false
render
layout:
false
...
@@ -413,7 +413,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -413,7 +413,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
if
params
[
:ref
].
present?
if
params
[
:ref
].
present?
@ref
=
params
[
:ref
]
@ref
=
params
[
:ref
]
@commit
=
@target_project
.
commit
(
@ref
)
@commit
=
@target_project
.
commit
(
"refs/heads/
#{
@ref
}
"
)
end
end
render
layout:
false
render
layout:
false
...
...
changelogs/unreleased/fix-issue-23237.yml
0 → 100644
View file @
4d6e377c
---
title
:
"
Fixes
an
issue
in
the
new
merge
request
form,
where
a
tag
would
be
selected
instead
of
a
branch
when
they
have
the
same
names"
merge_request
:
9535
author
:
Weiqing Chu
spec/features/merge_requests/create_new_mr_spec.rb
View file @
4d6e377c
...
@@ -12,6 +12,33 @@ feature 'Create New Merge Request', feature: true, js: true do
...
@@ -12,6 +12,33 @@ feature 'Create New Merge Request', feature: true, js: true do
login_as
user
login_as
user
end
end
it
'selects the source branch sha when a tag with the same name exists'
do
visit
namespace_project_merge_requests_path
(
project
.
namespace
,
project
)
click_link
'New Merge Request'
expect
(
page
).
to
have_content
(
'Source branch'
)
expect
(
page
).
to
have_content
(
'Target branch'
)
first
(
'.js-source-branch'
).
click
first
(
'.dropdown-source-branch .dropdown-content a'
,
text:
'v1.1.0'
).
click
expect
(
page
).
to
have_content
"b83d6e3"
end
it
'selects the target branch sha when a tag with the same name exists'
do
visit
namespace_project_merge_requests_path
(
project
.
namespace
,
project
)
click_link
'New Merge Request'
expect
(
page
).
to
have_content
(
'Source branch'
)
expect
(
page
).
to
have_content
(
'Target branch'
)
first
(
'.js-target-branch'
).
click
first
(
'.dropdown-target-branch .dropdown-content a'
,
text:
'v1.1.0'
).
click
expect
(
page
).
to
have_content
"b83d6e3"
end
it
'generates a diff for an orphaned branch'
do
it
'generates a diff for an orphaned branch'
do
visit
namespace_project_merge_requests_path
(
project
.
namespace
,
project
)
visit
namespace_project_merge_requests_path
(
project
.
namespace
,
project
)
...
...
spec/features/projects/compare_spec.rb
View file @
4d6e377c
...
@@ -53,6 +53,7 @@ describe "Compare", js: true do
...
@@ -53,6 +53,7 @@ describe "Compare", js: true do
dropdown
=
find
(
".js-compare-
#{
dropdown_type
}
-dropdown"
)
dropdown
=
find
(
".js-compare-
#{
dropdown_type
}
-dropdown"
)
dropdown
.
find
(
".compare-dropdown-toggle"
).
click
dropdown
.
find
(
".compare-dropdown-toggle"
).
click
dropdown
.
fill_in
(
"Filter by Git revision"
,
with:
selection
)
dropdown
.
fill_in
(
"Filter by Git revision"
,
with:
selection
)
find_link
(
selection
,
visible:
true
).
click
wait_for_ajax
dropdown
.
find_all
(
"a[data-ref=
\"
#{
selection
}
\"
]"
,
visible:
true
).
last
.
click
end
end
end
end
spec/support/test_env.rb
View file @
4d6e377c
...
@@ -37,9 +37,10 @@ module TestEnv
...
@@ -37,9 +37,10 @@ module TestEnv
'conflict-too-large'
=>
'39fa04f'
,
'conflict-too-large'
=>
'39fa04f'
,
'deleted-image-test'
=>
'6c17798'
,
'deleted-image-test'
=>
'6c17798'
,
'wip'
=>
'b9238ee'
,
'wip'
=>
'b9238ee'
,
'csv'
=>
'3dd0896'
'csv'
=>
'3dd0896'
,
'v1.1.0'
=>
'b83d6e3'
}.
freeze
}.
freeze
# gitlab-test-fork is a fork of gitlab-fork, but we don't necessarily
# gitlab-test-fork is a fork of gitlab-fork, but we don't necessarily
# need to keep all the branches in sync.
# need to keep all the branches in sync.
# We currently only need a subset of the branches
# We currently only need a subset of the branches
...
...
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