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
30b0d06e
Commit
30b0d06e
authored
Jan 28, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs
parent
5cce1278
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
4 deletions
+7
-4
app/models/merge_request.rb
app/models/merge_request.rb
+2
-2
app/models/project.rb
app/models/project.rb
+2
-1
app/models/repository.rb
app/models/repository.rb
+2
-0
spec/models/build_spec.rb
spec/models/build_spec.rb
+1
-1
No files found.
app/models/merge_request.rb
View file @
30b0d06e
...
...
@@ -183,7 +183,7 @@ class MergeRequest < ActiveRecord::Base
def
diff_base_commit
if
merge_request_diff
merge_request_diff
.
base_commit
els
e
els
if
source_sha
self
.
target_project
.
merge_base_commit
(
self
.
source_sha
,
self
.
target_branch
)
end
end
...
...
@@ -489,7 +489,7 @@ class MergeRequest < ActiveRecord::Base
end
def
source_sha
last_commit
.
sha
last_commit
.
try
(
:sha
)
end
def
fetch_ref
...
...
app/models/project.rb
View file @
30b0d06e
...
...
@@ -349,7 +349,8 @@ class Project < ActiveRecord::Base
end
def
merge_base_commit
(
first_commit_id
,
second_commit_id
)
repository
.
commit
(
repository
.
merge_base
(
first_commit_id
,
second_commit_id
))
sha
=
repository
.
merge_base
(
first_commit_id
,
second_commit_id
)
repository
.
commit
(
sha
)
if
sha
end
def
saved?
...
...
app/models/repository.rb
View file @
30b0d06e
...
...
@@ -589,6 +589,8 @@ class Repository
def
merge_base
(
first_commit_id
,
second_commit_id
)
rugged
.
merge_base
(
first_commit_id
,
second_commit_id
)
rescue
Rugged
::
ReferenceError
nil
end
def
is_ancestor?
(
ancestor_id
,
descendant_id
)
...
...
spec/models/build_spec.rb
View file @
30b0d06e
require
'spec_helper'
describe
Ci
::
Build
,
models:
true
do
let
(
:project
)
{
FactoryGirl
.
create
:
empty_
project
}
let
(
:project
)
{
FactoryGirl
.
create
:project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
let
(
:build
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
}
...
...
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