From 7bb817e6d19f21ccb16c6ba1eecd0e89fd052322 Mon Sep 17 00:00:00 2001 From: Benno Date: Wed, 30 Oct 2019 05:32:21 +0800 Subject: Respect LFS File Lock on UI (#8719) * update #8687 respect file locking * upate #8687 Add LFS locker information * update #8719 enhance coding style and return error --- models/repo.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'models/repo.go') diff --git a/models/repo.go b/models/repo.go index ac3443f895..7945cb309d 100644 --- a/models/repo.go +++ b/models/repo.go @@ -2810,3 +2810,19 @@ func (repo *Repository) GetOriginalURLHostname() string { return u.Host } + +// GetTreePathLock returns LSF lock for the treePath +func (repo *Repository) GetTreePathLock(treePath string) (*LFSLock, error) { + if setting.LFS.StartServer { + locks, err := GetLFSLockByRepoID(repo.ID) + if err != nil { + return nil, err + } + for _, lock := range locks { + if lock.Path == treePath { + return lock, nil + } + } + } + return nil, nil +} -- cgit v1.2.3