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
4374a38f
Commit
4374a38f
authored
Nov 15, 2017
by
micael.bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix the commit reference pattern from matching other entities
parent
a4072db0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
1 deletion
+29
-1
app/models/commit.rb
app/models/commit.rb
+1
-1
changelogs/unreleased/39461-notes-api-for-issues-no-longer-returns-label-additions-removals.yml
...for-issues-no-longer-returns-label-additions-removals.yml
+5
-0
spec/models/commit_spec.rb
spec/models/commit_spec.rb
+23
-0
No files found.
app/models/commit.rb
View file @
4374a38f
...
...
@@ -26,7 +26,7 @@ class Commit
DIFF_HARD_LIMIT_LINES
=
50000
MIN_SHA_LENGTH
=
7
COMMIT_SHA_PATTERN
=
/\h{
#{
MIN_SHA_LENGTH
}
,40}/
.
freeze
COMMIT_SHA_PATTERN
=
/\
b(?<![~#!@:])\
h{
#{
MIN_SHA_LENGTH
}
,40}/
.
freeze
def
banzai_render_context
(
field
)
context
=
{
pipeline: :single_line
,
project:
self
.
project
}
...
...
changelogs/unreleased/39461-notes-api-for-issues-no-longer-returns-label-additions-removals.yml
0 → 100644
View file @
4374a38f
---
title
:
Label addition/removal are not going to be redacted wrongfully in the API.
merge_request
:
15080
author
:
type
:
fixed
spec/models/commit_spec.rb
View file @
4374a38f
...
...
@@ -468,4 +468,27 @@ eos
expect
(
described_class
.
valid_hash?
(
'a'
*
41
)).
to
be
false
end
end
describe
'.reference_pattern'
do
where
(
:ref
,
:matches?
)
do
sha
=
Digest
::
SHA1
.
hexdigest
'thisisacommitid'
[
[
sha
.
first
(
Commit
::
MIN_SHA_LENGTH
-
1
),
false
],
[
sha
.
first
(
Commit
::
MIN_SHA_LENGTH
),
true
],
[
sha
,
true
],
[
'~'
<<
sha
,
false
],
# labels
[
'!'
<<
sha
,
false
],
# merge_request
[
':'
<<
sha
,
false
],
# emoji
[
'#'
<<
sha
,
false
],
# issue
[
'@'
<<
sha
,
false
],
# user
]
end
with_them
do
it
"should match only on commit references"
do
expect
(
Commit
.
reference_pattern
.
match
(
ref
).
present?
).
to
eq
(
matches?
)
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