Skip to content

Commit

Permalink
Remove LFS from names within the lfs package
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Thornton <[email protected]>
  • Loading branch information
zeripath committed Feb 7, 2019
1 parent 0e26b72 commit 6be64fb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions modules/lfs/lfs_pointers.go → modules/lfs/pointers.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"code.gitea.io/gitea/modules/setting"
)

// ReadLFSPointerFile will return a partially filled LFSMetaObject if the provided reader is a pointer file
func ReadLFSPointerFile(reader io.Reader) (*models.LFSMetaObject, *[]byte) {
// ReadPointerFile will return a partially filled LFSMetaObject if the provided reader is a pointer file
func ReadPointerFile(reader io.Reader) (*models.LFSMetaObject, *[]byte) {
if !setting.LFS.StartServer {
return nil, nil
}
Expand All @@ -28,11 +28,11 @@ func ReadLFSPointerFile(reader io.Reader) (*models.LFSMetaObject, *[]byte) {
return nil, nil
}

return IsLFSPointerFile(&buf), &buf
return IsPointerFile(&buf), &buf
}

// IsLFSPointerFile will return a partially filled LFSMetaObject if the provided byte slice is a pointer file
func IsLFSPointerFile(buf *[]byte) *models.LFSMetaObject {
// IsPointerFile will return a partially filled LFSMetaObject if the provided byte slice is a pointer file
func IsPointerFile(buf *[]byte) *models.LFSMetaObject {
if !setting.LFS.StartServer {
return nil
}
Expand Down Expand Up @@ -62,8 +62,8 @@ func IsLFSPointerFile(buf *[]byte) *models.LFSMetaObject {
return meta
}

// ReadLFSMetaObject will read an LFS object and return a reader
func ReadLFSMetaObject(meta *models.LFSMetaObject) (io.ReadCloser, error) {
// ReadMetaObject will read a models.LFSMetaObject and return a reader
func ReadMetaObject(meta *models.LFSMetaObject) (io.ReadCloser, error) {
contentStore := &ContentStore{BasePath: setting.LFS.ContentPath}
return contentStore.Get(meta, 0)
}
4 changes: 2 additions & 2 deletions routers/repo/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ func ServeBlobOrLFS(ctx *context.Context, blob *git.Blob) error {
}
defer dataRc.Close()

if meta, _ := lfs.ReadLFSPointerFile(dataRc); meta != nil {
if meta, _ := lfs.ReadPointerFile(dataRc); meta != nil {
meta, _ = ctx.Repo.Repository.GetLFSMetaObjectByOid(meta.Oid)
if meta == nil {
return ServeBlob(ctx, blob)
}
lfsDataRc, err := lfs.ReadLFSMetaObject(meta)
lfsDataRc, err := lfs.ReadMetaObject(meta)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions routers/repo/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,15 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st

//Check for LFS meta file
if isTextFile {
if meta := lfs.IsLFSPointerFile(&buf); meta != nil {
if meta := lfs.IsPointerFile(&buf); meta != nil {
if meta, _ = ctx.Repo.Repository.GetLFSMetaObjectByOid(meta.Oid); meta != nil {
ctx.Data["IsLFSFile"] = true
isLFSFile = true

// OK read the lfs object
dataRc, err := lfs.ReadLFSMetaObject(meta)
dataRc, err := lfs.ReadMetaObject(meta)
if err != nil {
ctx.ServerError("ReadLFSMetaObject", err)
ctx.ServerError("ReadMetaObject", err)
return
}
defer dataRc.Close()
Expand Down

0 comments on commit 6be64fb

Please sign in to comment.