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
This commit is contained in:
Benno 2019-10-30 05:32:21 +08:00 committed by Lauris BH
parent e7fbc551ab
commit 7bb817e6d1
5 changed files with 61 additions and 6 deletions

View file

@ -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
}