BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
1ae557c1
Commit
1ae557c1
authored
Nov 03, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge status_for and status, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7034#note_17742297
parent
ee4c8b75
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
43 deletions
+41
-43
ci_status_helper.rb
app/helpers/ci_status_helper.rb
+1
-1
commit.rb
app/models/commit.rb
+1
-5
_last_commit.html.haml
app/views/projects/_last_commit.html.haml
+1
-1
_commit.html.haml
app/views/projects/commits/_commit.html.haml
+2
-2
commit_spec.rb
spec/models/commit_spec.rb
+36
-34
No files found.
app/helpers/ci_status_helper.rb
View file @
1ae557c1
...
...
@@ -63,7 +63,7 @@ module CiStatusHelper
render_status_with_link
(
'commit'
,
commit
.
status
_for
(
ref
),
commit
.
status
(
ref
),
path
,
tooltip_placement:
tooltip_placement
)
end
...
...
app/models/commit.rb
View file @
1ae557c1
...
...
@@ -230,11 +230,7 @@ class Commit
project
.
pipelines
.
where
(
sha:
sha
)
end
def
status
status_for
(
nil
)
end
def
status_for
(
ref
)
def
status
(
ref
=
nil
)
if
@statuses
.
key?
(
ref
)
@statuses
[
ref
]
elsif
ref
...
...
app/views/projects/_last_commit.html.haml
View file @
1ae557c1
-
status
=
commit
.
status
_for
(
ref
)
-
status
=
commit
.
status
(
ref
)
-
if
status
=
link_to
builds_namespace_project_commit_path
(
commit
.
project
.
namespace
,
commit
.
project
,
commit
),
class:
"ci-status ci-
#{
status
}
"
do
=
ci_icon_for_status
(
status
)
...
...
app/views/projects/commits/_commit.html.haml
View file @
1ae557c1
...
...
@@ -18,14 +18,14 @@
%span
.commit-row-message.visible-xs-inline
·
=
commit
.
short_id
-
if
commit
.
status
_for
(
ref
)
-
if
commit
.
status
(
ref
)
.visible-xs-inline
=
render_commit_status
(
commit
,
ref:
ref
)
-
if
commit
.
description?
%a
.text-expander.hidden-xs.js-toggle-button
...
.commit-actions.hidden-xs
-
if
commit
.
status
_for
(
ref
)
-
if
commit
.
status
(
ref
)
=
render_commit_status
(
commit
,
ref:
ref
)
=
clipboard_button
(
clipboard_text:
commit
.
id
)
=
link_to
commit
.
short_id
,
namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
),
class:
"commit-short-id btn btn-transparent"
...
...
spec/models/commit_spec.rb
View file @
1ae557c1
...
...
@@ -210,49 +210,51 @@ eos
end
describe
'#status'
do
shared_examples
'giving the status from pipeline'
do
it
do
expect
(
commit
.
status
).
to
eq
(
Ci
::
Pipeline
.
status
)
context
'without arguments for compound status'
do
shared_examples
'giving the status from pipeline'
do
it
do
expect
(
commit
.
status
).
to
eq
(
Ci
::
Pipeline
.
status
)
end
end
end
context
'with pipelines'
do
let!
(
:pipeline
)
do
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
commit
.
sha
)
end
context
'with pipelines'
do
let!
(
:pipeline
)
do
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
commit
.
sha
)
end
it_behaves_like
'giving the status from pipeline'
end
it_behaves_like
'giving the status from pipeline'
end
context
'without pipelines'
do
it_behaves_like
'giving the status from pipeline'
context
'without pipelines'
do
it_behaves_like
'giving the status from pipeline'
end
end
end
describe
'#status_for
'
do
let!
(
:pipeline_from_master
)
do
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
commit
.
sha
,
ref:
'master'
,
status:
'failed'
)
end
context
'when a particular ref is specified
'
do
let!
(
:pipeline_from_master
)
do
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
commit
.
sha
,
ref:
'master'
,
status:
'failed'
)
end
let!
(
:pipeline_from_fix
)
do
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
commit
.
sha
,
ref:
'fix'
,
status:
'success'
)
end
let!
(
:pipeline_from_fix
)
do
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
commit
.
sha
,
ref:
'fix'
,
status:
'success'
)
end
it
'gives pipelines from a particular branch'
do
expect
(
commit
.
status_for
(
'master'
)).
to
eq
(
pipeline_from_master
.
status
)
expect
(
commit
.
status_for
(
'fix'
)).
to
eq
(
pipeline_from_fix
.
status
)
end
it
'gives pipelines from a particular branch'
do
expect
(
commit
.
status
(
'master'
)).
to
eq
(
pipeline_from_master
.
status
)
expect
(
commit
.
status
(
'fix'
)).
to
eq
(
pipeline_from_fix
.
status
)
end
it
'gives compound status if ref is nil'
do
expect
(
commit
.
status_for
(
nil
)).
to
eq
(
commit
.
status
)
it
'gives compound status if ref is nil'
do
expect
(
commit
.
status
(
nil
)).
to
eq
(
commit
.
status
)
end
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