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
Léo-Paul Géneau
gitlab-ce
Commits
c1e39421
Commit
c1e39421
authored
Mar 16, 2018
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract constant for LfsPointerFile::VERSION_LINE
parent
9d32fccf
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
7 deletions
+10
-7
lib/gitlab/git/lfs_pointer_file.rb
lib/gitlab/git/lfs_pointer_file.rb
+4
-1
spec/services/files/create_service_spec.rb
spec/services/files/create_service_spec.rb
+2
-2
spec/services/files/multi_service_spec.rb
spec/services/files/multi_service_spec.rb
+2
-2
spec/services/lfs/file_transformer_spec.rb
spec/services/lfs/file_transformer_spec.rb
+2
-2
No files found.
lib/gitlab/git/lfs_pointer_file.rb
View file @
c1e39421
module
Gitlab
module
Git
class
LfsPointerFile
VERSION
=
"https://git-lfs.github.com/spec/v1"
.
freeze
VERSION_LINE
=
"version
#{
VERSION
}
"
.
freeze
def
initialize
(
data
)
@data
=
data
end
def
pointer
@pointer
||=
<<~
FILE
version https://git-lfs.github.com/spec/v1
#{
VERSION_LINE
}
oid sha256:
#{
sha256
}
size
#{
size
}
FILE
...
...
spec/services/files/create_service_spec.rb
View file @
c1e39421
...
...
@@ -43,7 +43,7 @@ describe Files::CreateService do
blob
=
repository
.
blob_at
(
'lfs'
,
file_path
)
expect
(
blob
.
data
).
not_to
start_with
(
'version https://git-lfs.github.com/spec/v1'
)
expect
(
blob
.
data
).
not_to
start_with
(
Gitlab
::
Git
::
LfsPointerFile
::
VERSION_LINE
)
expect
(
blob
.
data
).
to
eq
(
file_content
)
end
end
...
...
@@ -58,7 +58,7 @@ describe Files::CreateService do
blob
=
repository
.
blob_at
(
'lfs'
,
file_path
)
expect
(
blob
.
data
).
to
start_with
(
'version https://git-lfs.github.com/spec/v1'
)
expect
(
blob
.
data
).
to
start_with
(
Gitlab
::
Git
::
LfsPointerFile
::
VERSION_LINE
)
end
it
"creates an LfsObject with the file's content"
do
...
...
spec/services/files/multi_service_spec.rb
View file @
c1e39421
...
...
@@ -126,7 +126,7 @@ describe Files::MultiService do
blob
=
repository
.
blob_at
(
'lfs'
,
new_file_path
)
expect
(
blob
.
data
).
to
start_with
(
'version https://git-lfs.github.com/spec/v1'
)
expect
(
blob
.
data
).
to
start_with
(
Gitlab
::
Git
::
LfsPointerFile
::
VERSION_LINE
)
end
it
"creates an LfsObject with the file's content"
do
...
...
@@ -145,7 +145,7 @@ describe Files::MultiService do
blob
=
repository
.
blob_at
(
'lfs'
,
new_file_path
)
expect
(
blob
.
data
).
to
start_with
(
'version https://git-lfs.github.com/spec/v1'
)
expect
(
blob
.
data
).
to
start_with
(
Gitlab
::
Git
::
LfsPointerFile
::
VERSION_LINE
)
end
it
"creates an LfsObject with the file's content"
do
...
...
spec/services/lfs/file_transformer_spec.rb
View file @
c1e39421
...
...
@@ -53,7 +53,7 @@ describe Lfs::FileTransformer do
it
'returns an LFS pointer'
do
result
=
subject
.
new_file
(
file_path
,
file_content
)
expect
(
result
.
content
).
to
start_with
(
'version https://git-lfs.github.com/spec/v1'
)
expect
(
result
.
content
).
to
start_with
(
Gitlab
::
Git
::
LfsPointerFile
::
VERSION_LINE
)
end
it
'returns LFS pointer encoding as text'
do
...
...
@@ -68,7 +68,7 @@ describe Lfs::FileTransformer do
it
"doesn't create LFS pointers"
do
new_content
=
subject
.
new_file
(
file_path
,
file_content
).
content
expect
(
new_content
).
not_to
start_with
(
'version https://git-lfs.github.com/spec/v1'
)
expect
(
new_content
).
not_to
start_with
(
Gitlab
::
Git
::
LfsPointerFile
::
VERSION_LINE
)
expect
(
new_content
).
to
eq
(
file_content
)
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