d2a77094ae
Uses Lfs::FileModificationHandler to coordinate LFS detection, creation of LfsObject, etc Caveats: 1. This isn't used by the multi-file editor / Web IDE 2. This isn't used on rename. We'd need to be able to download LFS files and add them to the commit if they no longer match so not as simple. 3. We only check the root .gitattributes file, so this should be improved to correctly check for nested .gitattributes files in subfolders.
25 lines
445 B
Ruby
25 lines
445 B
Ruby
module Gitlab
|
|
module Git
|
|
class LfsPointerFile
|
|
def initialize(data)
|
|
@data = data
|
|
end
|
|
|
|
def pointer
|
|
@pointer ||= <<~FILE
|
|
version https://git-lfs.github.com/spec/v1
|
|
oid sha256:#{sha256}
|
|
size #{size}
|
|
FILE
|
|
end
|
|
|
|
def size
|
|
@size ||= @data.bytesize
|
|
end
|
|
|
|
def sha256
|
|
@sha256 ||= Digest::SHA256.hexdigest(@data)
|
|
end
|
|
end
|
|
end
|
|
end
|