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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
5d6dc871
Commit
5d6dc871
authored
Nov 19, 2019
by
Fabio Pitino
Committed by
Kamil Trzciński
Nov 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix style reset in job log
When ANSI sequence is empty (\e[m) issue a style reset, same as \e[0m
parent
bf24aef3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
7 deletions
+20
-7
changelogs/unreleased/fix-job-log-style-reset.yml
changelogs/unreleased/fix-job-log-style-reset.yml
+5
-0
lib/gitlab/ci/ansi2json/style.rb
lib/gitlab/ci/ansi2json/style.rb
+14
-7
spec/lib/gitlab/ci/ansi2json/style_spec.rb
spec/lib/gitlab/ci/ansi2json/style_spec.rb
+1
-0
No files found.
changelogs/unreleased/fix-job-log-style-reset.yml
0 → 100644
View file @
5d6dc871
---
title
:
Fix style reset in job log when empty ANSI sequence is encoutered
merge_request
:
20367
author
:
type
:
fixed
lib/gitlab/ci/ansi2json/style.rb
View file @
5d6dc871
...
...
@@ -15,14 +15,10 @@ module Gitlab
end
def
update
(
ansi_commands
)
command
=
ansi_commands
.
shift
return
unless
command
if
changes
=
Gitlab
::
Ci
::
Ansi2json
::
Parser
.
new
(
command
,
ansi_commands
).
changes
apply_changes
(
changes
)
end
# treat e\[m as \e[0m
ansi_commands
=
[
'0'
]
if
ansi_commands
.
empty?
update
(
ansi_commands
)
evaluate_stack_command
(
ansi_commands
)
end
def
set?
...
...
@@ -50,6 +46,17 @@ module Gitlab
private
def
evaluate_stack_command
(
ansi_commands
)
command
=
ansi_commands
.
shift
return
unless
command
if
changes
=
Gitlab
::
Ci
::
Ansi2json
::
Parser
.
new
(
command
,
ansi_commands
).
changes
apply_changes
(
changes
)
end
evaluate_stack_command
(
ansi_commands
)
end
def
apply_changes
(
changes
)
case
when
changes
[
:reset
]
...
...
spec/lib/gitlab/ci/ansi2json/style_spec.rb
View file @
5d6dc871
...
...
@@ -143,6 +143,7 @@ describe Gitlab::Ci::Ansi2json::Style do
[[],
%w[106]
,
'term-bg-l-cyan'
,
'sets bg color light cyan'
],
[[],
%w[107]
,
'term-bg-l-white'
,
'sets bg color light white'
],
# reset
[
%w[1]
,
%w[]
,
''
,
'resets style from format bold'
],
[
%w[1]
,
%w[0]
,
''
,
'resets style from format bold'
],
[
%w[1 3]
,
%w[0]
,
''
,
'resets style from format bold and italic'
],
[
%w[1 3 term-fg-l-red term-bg-yellow]
,
%w[0]
,
''
,
'resets all formats and colors'
],
...
...
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