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
50e62b3e
Commit
50e62b3e
authored
Sep 14, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Commit#status, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6305#note_15230024
parent
05faeec7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
3 deletions
+3
-3
app/models/commit.rb
app/models/commit.rb
+1
-1
app/models/concerns/has_status.rb
app/models/concerns/has_status.rb
+1
-1
spec/requests/api/commits_spec.rb
spec/requests/api/commits_spec.rb
+1
-1
No files found.
app/models/commit.rb
View file @
50e62b3e
...
@@ -231,7 +231,7 @@ class Commit
...
@@ -231,7 +231,7 @@ class Commit
def
status
def
status
return
@status
if
defined?
(
@status
)
return
@status
if
defined?
(
@status
)
@status
||=
pipelines
.
order
(
:id
).
last
.
try
(
:status
)
@status
||=
pipelines
.
status
end
end
def
revert_branch_name
def
revert_branch_name
...
...
app/models/concerns/has_status.rb
View file @
50e62b3e
...
@@ -20,7 +20,7 @@ module HasStatus
...
@@ -20,7 +20,7 @@ module HasStatus
skipped
=
scope
.
skipped
.
select
(
'count(*)'
).
to_sql
skipped
=
scope
.
skipped
.
select
(
'count(*)'
).
to_sql
deduce_status
=
"(CASE
deduce_status
=
"(CASE
WHEN (
#{
builds
}
)=
0
THEN NULL
WHEN (
#{
builds
}
)=
(
#{
created
}
)
THEN NULL
WHEN (
#{
builds
}
)=(
#{
skipped
}
) THEN 'skipped'
WHEN (
#{
builds
}
)=(
#{
skipped
}
) THEN 'skipped'
WHEN (
#{
builds
}
)=(
#{
success
}
)+(
#{
ignored
}
)+(
#{
skipped
}
) THEN 'success'
WHEN (
#{
builds
}
)=(
#{
success
}
)+(
#{
ignored
}
)+(
#{
skipped
}
) THEN 'success'
WHEN (
#{
builds
}
)=(
#{
created
}
)+(
#{
pending
}
)+(
#{
skipped
}
) THEN 'pending'
WHEN (
#{
builds
}
)=(
#{
created
}
)+(
#{
pending
}
)+(
#{
skipped
}
) THEN 'pending'
...
...
spec/requests/api/commits_spec.rb
View file @
50e62b3e
...
@@ -110,7 +110,7 @@ describe API::API, api: true do
...
@@ -110,7 +110,7 @@ describe API::API, api: true do
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits/
#{
project
.
repository
.
commit
.
id
}
"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits/
#{
project
.
repository
.
commit
.
id
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
[
'status'
]).
to
eq
(
'created'
)
expect
(
json_response
[
'status'
]).
to
be_nil
end
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