aboutsummaryrefslogtreecommitdiffstats
path: root/models/repo.go
diff options
context:
space:
mode:
authorBenno <blueworrybear@gmail.com>2019-10-30 05:32:21 +0800
committerLauris BH <lauris@nix.lv>2019-10-29 23:32:21 +0200
commit7bb817e6d19f21ccb16c6ba1eecd0e89fd052322 (patch)
treee31718968ed52f5f481fa11ccf9859215a37e261 /models/repo.go
parente7fbc551ab7b743761f90997864ed8c11e4f9c39 (diff)
downloadgitea-7bb817e6d19f21ccb16c6ba1eecd0e89fd052322.tar.gz
gitea-7bb817e6d19f21ccb16c6ba1eecd0e89fd052322.zip
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
Diffstat (limited to 'models/repo.go')
-rw-r--r--models/repo.go16
1 files changed, 16 insertions, 0 deletions
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
+}