diff options
author | Lauris BH <lauris@nix.lv> | 2017-10-30 14:11:56 +0200 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-10-30 20:11:56 +0800 |
commit | 82fc50f4ee6c078d669a8d51310c48e450a3886d (patch) | |
tree | 3e62b487c4916f1e7d0f8de1ed5851de52485ba9 /models | |
parent | 513375c429435ba60a667b219bdfb00e5b760b38 (diff) | |
download | gitea-82fc50f4ee6c078d669a8d51310c48e450a3886d.tar.gz gitea-82fc50f4ee6c078d669a8d51310c48e450a3886d.zip |
Fix Git LFS object/repo link storage in database and small refactoring (#2803)
Diffstat (limited to 'models')
-rw-r--r-- | models/lfs.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/models/lfs.go b/models/lfs.go index 842e48e409..d6cdc68892 100644 --- a/models/lfs.go +++ b/models/lfs.go @@ -70,12 +70,12 @@ func NewLFSMetaObject(m *LFSMetaObject) (*LFSMetaObject, error) { // GetLFSMetaObjectByOid selects a LFSMetaObject entry from database by its OID. // It may return ErrLFSObjectNotExist or a database error. If the error is nil, // the returned pointer is a valid LFSMetaObject. -func GetLFSMetaObjectByOid(oid string) (*LFSMetaObject, error) { +func (repo *Repository) GetLFSMetaObjectByOid(oid string) (*LFSMetaObject, error) { if len(oid) == 0 { return nil, ErrLFSObjectNotExist } - m := &LFSMetaObject{Oid: oid} + m := &LFSMetaObject{Oid: oid, RepositoryID: repo.ID} has, err := x.Get(m) if err != nil { return nil, err @@ -87,7 +87,7 @@ func GetLFSMetaObjectByOid(oid string) (*LFSMetaObject, error) { // RemoveLFSMetaObjectByOid removes a LFSMetaObject entry from database by its OID. // It may return ErrLFSObjectNotExist or a database error. -func RemoveLFSMetaObjectByOid(oid string) error { +func (repo *Repository) RemoveLFSMetaObjectByOid(oid string) error { if len(oid) == 0 { return ErrLFSObjectNotExist } @@ -98,8 +98,7 @@ func RemoveLFSMetaObjectByOid(oid string) error { return err } - m := &LFSMetaObject{Oid: oid} - + m := &LFSMetaObject{Oid: oid, RepositoryID: repo.ID} if _, err := sess.Delete(m); err != nil { return err } |