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:
parent
e7fbc551ab
commit
7bb817e6d1
5 changed files with 61 additions and 6 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue