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
2718930b
Commit
2718930b
authored
Feb 17, 2020
by
Kerri Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define counter for #truncated?
parent
f378b397
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
lib/gitlab/git/blob.rb
lib/gitlab/git/blob.rb
+9
-0
spec/lib/gitlab/git/blob_spec.rb
spec/lib/gitlab/git/blob_spec.rb
+10
-0
No files found.
lib/gitlab/git/blob.rb
View file @
2718930b
...
...
@@ -5,6 +5,7 @@ module Gitlab
class
Blob
include
Gitlab
::
BlobHelper
include
Gitlab
::
EncodingHelper
include
Gitlab
::
Metrics
::
Methods
extend
Gitlab
::
Git
::
WrapsGitalyErrors
# This number is the maximum amount of data that we want to display to
...
...
@@ -26,6 +27,14 @@ module Gitlab
attr_accessor
:name
,
:path
,
:size
,
:data
,
:mode
,
:id
,
:commit_id
,
:loaded_size
,
:binary
define_counter
:gitlab_blob_truncated_true
do
docstring
'blob.truncated? == true'
end
define_counter
:gitlab_blob_truncated_false
do
docstring
'blob.truncated? == false'
end
class
<<
self
def
find
(
repository
,
sha
,
path
,
limit:
MAX_DATA_DISPLAY_SIZE
)
tree_entry
(
repository
,
sha
,
path
,
limit
)
...
...
spec/lib/gitlab/git/blob_spec.rb
View file @
2718930b
...
...
@@ -588,4 +588,14 @@ describe Gitlab::Git::Blob, :seed_helper do
end
end
end
describe
'metrics'
do
it
'defines :gitlab_blob_truncated_true counter'
do
expect
(
described_class
).
to
respond_to
(
:gitlab_blob_truncated_true
)
end
it
'defines :gitlab_blob_truncated_false counter'
do
expect
(
described_class
).
to
respond_to
(
:gitlab_blob_truncated_false
)
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