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
Jérome Perrin
gitlab-ce
Commits
41a5adca
Commit
41a5adca
authored
Aug 10, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't try to create diffs if one of the branch is missing
Also fix a few tests
parent
8730cd86
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
20 deletions
+18
-20
app/models/merge_request.rb
app/models/merge_request.rb
+2
-1
spec/controllers/projects/issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+1
-1
spec/features/merge_requests/filter_by_labels_spec.rb
spec/features/merge_requests/filter_by_labels_spec.rb
+5
-5
spec/features/merge_requests/user_lists_merge_requests_spec.rb
...features/merge_requests/user_lists_merge_requests_spec.rb
+7
-9
spec/finders/environments_finder_spec.rb
spec/finders/environments_finder_spec.rb
+1
-1
spec/lib/gitlab/git/repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+2
-3
No files found.
app/models/merge_request.rb
View file @
41a5adca
...
...
@@ -443,7 +443,8 @@ class MergeRequest < ActiveRecord::Base
end
def
reload_diff_if_branch_changed
if
source_branch_changed?
||
target_branch_changed?
if
(
source_branch_changed?
||
target_branch_changed?
)
&&
(
source_branch_head
&&
target_branch_head
)
reload_diff
end
end
...
...
spec/controllers/projects/issues_controller_spec.rb
View file @
41a5adca
...
...
@@ -841,7 +841,7 @@ describe Projects::IssuesController do
describe
'POST #toggle_award_emoji'
do
before
do
sign_in
(
user
)
project
.
team
<<
[
user
,
:developer
]
project
.
add_developer
(
user
)
end
it
"toggles the award emoji"
do
...
...
spec/features/merge_requests/filter_by_labels_spec.rb
View file @
41a5adca
require
'rails_helper'
feature
'Merge Request filtering by Labels'
,
js:
true
do
feature
'Merge Request filtering by Labels'
,
:js
do
include
FilteredSearchHelpers
include
MergeRequestHelpers
...
...
@@ -12,9 +12,9 @@ feature 'Merge Request filtering by Labels', js: true do
let!
(
:feature
)
{
create
(
:label
,
project:
project
,
title:
'feature'
)
}
let!
(
:enhancement
)
{
create
(
:label
,
project:
project
,
title:
'enhancement'
)
}
let!
(
:mr1
)
{
create
(
:merge_request
,
title:
"Bugfix1"
,
source_project:
project
,
target_project:
project
,
source_branch:
"
bugfix1
"
)
}
let!
(
:mr2
)
{
create
(
:merge_request
,
title:
"Bugfix2"
,
source_project:
project
,
target_project:
project
,
source_branch:
"
bugfix2
"
)
}
let!
(
:mr3
)
{
create
(
:merge_request
,
title:
"Feature1"
,
source_project:
project
,
target_project:
project
,
source_branch:
"
feature1
"
)
}
let!
(
:mr1
)
{
create
(
:merge_request
,
title:
"Bugfix1"
,
source_project:
project
,
target_project:
project
,
source_branch:
"
fix
"
)
}
let!
(
:mr2
)
{
create
(
:merge_request
,
title:
"Bugfix2"
,
source_project:
project
,
target_project:
project
,
source_branch:
"
wip
"
)
}
let!
(
:mr3
)
{
create
(
:merge_request
,
title:
"Feature1"
,
source_project:
project
,
target_project:
project
,
source_branch:
"
improve/awesome
"
)
}
before
do
mr1
.
labels
<<
bug
...
...
@@ -25,7 +25,7 @@ feature 'Merge Request filtering by Labels', js: true do
mr3
.
title
=
"Feature1"
mr3
.
labels
<<
feature
project
.
team
<<
[
user
,
:master
]
project
.
add_master
(
user
)
sign_in
(
user
)
visit
project_merge_requests_path
(
project
)
...
...
spec/features/merge_requests/user_lists_merge_requests_spec.rb
View file @
41a5adca
...
...
@@ -24,12 +24,10 @@ describe 'Projects > Merge requests > User lists merge requests' do
milestone:
create
(
:milestone
,
due_date:
'2013-12-12'
),
created_at:
2
.
minutes
.
ago
,
updated_at:
2
.
minutes
.
ago
)
# lfs in itself is not a great choice for the title if one wants to match the whole body content later on
# just think about the scenario when faker generates 'Chester Runolfsson' as the user's name
create
(
:merge_request
,
title:
'merge
_lfs
'
,
title:
'merge
-test
'
,
source_project:
project
,
source_branch:
'merge
_lfs
'
,
source_branch:
'merge
-test
'
,
created_at:
3
.
minutes
.
ago
,
updated_at:
10
.
seconds
.
ago
)
end
...
...
@@ -38,7 +36,7 @@ describe 'Projects > Merge requests > User lists merge requests' do
visit_merge_requests
(
project
,
assignee_id:
IssuableFinder
::
NONE
)
expect
(
current_path
).
to
eq
(
project_merge_requests_path
(
project
))
expect
(
page
).
to
have_content
'merge
_lfs
'
expect
(
page
).
to
have_content
'merge
-test
'
expect
(
page
).
not_to
have_content
'fix'
expect
(
page
).
not_to
have_content
'markdown'
expect
(
count_merge_requests
).
to
eq
(
1
)
...
...
@@ -47,7 +45,7 @@ describe 'Projects > Merge requests > User lists merge requests' do
it
'filters on a specific assignee'
do
visit_merge_requests
(
project
,
assignee_id:
user
.
id
)
expect
(
page
).
not_to
have_content
'merge
_lfs
'
expect
(
page
).
not_to
have_content
'merge
-test
'
expect
(
page
).
to
have_content
'fix'
expect
(
page
).
to
have_content
'markdown'
expect
(
count_merge_requests
).
to
eq
(
2
)
...
...
@@ -57,14 +55,14 @@ describe 'Projects > Merge requests > User lists merge requests' do
visit_merge_requests
(
project
,
sort:
sort_value_recently_created
)
expect
(
first_merge_request
).
to
include
(
'fix'
)
expect
(
last_merge_request
).
to
include
(
'merge
_lfs
'
)
expect
(
last_merge_request
).
to
include
(
'merge
-test
'
)
expect
(
count_merge_requests
).
to
eq
(
3
)
end
it
'sorts by oldest'
do
visit_merge_requests
(
project
,
sort:
sort_value_oldest_created
)
expect
(
first_merge_request
).
to
include
(
'merge
_lfs
'
)
expect
(
first_merge_request
).
to
include
(
'merge
-test
'
)
expect
(
last_merge_request
).
to
include
(
'fix'
)
expect
(
count_merge_requests
).
to
eq
(
3
)
end
...
...
@@ -72,7 +70,7 @@ describe 'Projects > Merge requests > User lists merge requests' do
it
'sorts by last updated'
do
visit_merge_requests
(
project
,
sort:
sort_value_recently_updated
)
expect
(
first_merge_request
).
to
include
(
'merge
_lfs
'
)
expect
(
first_merge_request
).
to
include
(
'merge
-test
'
)
expect
(
count_merge_requests
).
to
eq
(
3
)
end
...
...
spec/finders/environments_finder_spec.rb
View file @
41a5adca
...
...
@@ -12,7 +12,7 @@ describe EnvironmentsFinder do
context
'tagged deployment'
do
before
do
create
(
:deployment
,
environment:
environment
,
ref:
'1.0'
,
tag:
true
,
sha:
project
.
commit
.
id
)
create
(
:deployment
,
environment:
environment
,
ref:
'
v1.
1.0'
,
tag:
true
,
sha:
project
.
commit
.
id
)
end
it
'returns environment when with_tags is set'
do
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
41a5adca
...
...
@@ -1196,9 +1196,8 @@ describe Gitlab::Git::Repository, seed_helper: true do
def
create_remote_branch
(
repository
,
remote_name
,
branch_name
,
source_branch_name
)
source_branch
=
repository
.
branches
.
find
{
|
branch
|
branch
.
name
==
source_branch_name
}
repository
.
write_ref
(
"refs/remotes/
#{
remote_name
}
/
#{
branch_name
}
"
,
source_branch
.
dereferenced_target
.
sha
)
rugged
=
repository
.
rugged
rugged
.
references
.
create
(
"refs/remotes/
#{
remote_name
}
/
#{
branch_name
}
"
,
source_branch
.
dereferenced_target
.
sha
)
end
# Build the options hash that's passed to Rugged::Commit#create
...
...
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