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
Boxiang Sun
gitlab-ce
Commits
78771389
Commit
78771389
authored
Apr 03, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix creation of merge requests for orphaned branches
Closes #14875
parent
fee7ad86
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
2 deletions
+35
-2
CHANGELOG
CHANGELOG
+1
-0
app/views/projects/diffs/_image.html.haml
app/views/projects/diffs/_image.html.haml
+5
-2
spec/features/merge_requests/create_new_mr_spec.rb
spec/features/merge_requests/create_new_mr_spec.rb
+28
-0
spec/support/test_env.rb
spec/support/test_env.rb
+1
-0
No files found.
CHANGELOG
View file @
78771389
...
...
@@ -15,6 +15,7 @@ v 8.7.0 (unreleased)
- Implement 'Groups View' as an option for dashboard preferences !3379 (Elias W.)
- Implement 'TODOs View' as an option for dashboard preferences !3379 (Elias W.)
- Gracefully handle notes on deleted commits in merge requests (Stan Hu)
- Fix creation of merge requests for orphaned branches (Stan Hu)
- Fall back to `In-Reply-To` and `References` headers when sub-addressing is not available (David Padilla)
- Remove "Congratulations!" tweet button on newly-created project. (Connor Shea)
...
...
app/views/projects/diffs/_image.html.haml
View file @
78771389
-
diff
=
diff_file
.
diff
-
file_raw_path
=
namespace_project_raw_path
(
@project
.
namespace
,
@project
,
tree_join
(
@commit
.
id
,
diff
.
new_path
))
-
old_commit_id
=
diff_refs
.
first
.
id
-
old_file_raw_path
=
namespace_project_raw_path
(
@project
.
namespace
,
@project
,
tree_join
(
old_commit_id
,
diff
.
old_path
))
// diff_refs will be nil for orphaned commits (e.g. first commit in repo)
-
if
diff_refs
-
old_commit_id
=
diff_refs
.
first
.
id
-
old_file_raw_path
=
namespace_project_raw_path
(
@project
.
namespace
,
@project
,
tree_join
(
old_commit_id
,
diff
.
old_path
))
-
if
diff
.
renamed_file
||
diff
.
new_file
||
diff
.
deleted_file
.image
%span
.wrap
...
...
spec/features/merge_requests/create_new_mr_spec.rb
0 → 100644
View file @
78771389
require
'spec_helper'
feature
'Create New Merge Request'
,
feature:
true
,
js:
false
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
before
do
project
.
team
<<
[
user
,
:master
]
login_as
user
visit
namespace_project_merge_requests_path
(
project
.
namespace
,
project
)
end
it
'generates a diff for an orphaned branch'
do
click_link
'New Merge Request'
select
"orphaned-branch"
,
from:
"merge_request_source_branch"
select
"master"
,
from:
"merge_request_target_branch"
click_button
"Compare branches"
expect
(
page
).
to
have_content
"README.md"
expect
(
page
).
to
have_content
"wm.png"
fill_in
"merge_request_title"
,
with:
"Orphaned MR test"
click_button
"Submit merge request"
expect
(
page
).
to
have_content
'git checkout -b orphaned-branch origin/orphaned-branch'
end
end
spec/support/test_env.rb
View file @
78771389
...
...
@@ -15,6 +15,7 @@ module TestEnv
'lfs'
=>
'be93687'
,
'master'
=>
'5937ac0'
,
"'test'"
=>
'e56497b'
,
'orphaned-branch'
=>
'45127a9'
,
}
# gitlab-test-fork is a fork of gitlab-fork, but we don't necessarily
...
...
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