-
- Notifications
You must be signed in to change notification settings - Fork 6.2k
Git LFS lock api #2938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Git LFS lock api #2938
Conversation
9458fea
to 744a07e
Compare Codecov Report
@@ Coverage Diff @@ ## master #2938 +/- ## ========================================= + Coverage 32.73% 33.03% +0.3% ========================================= Files 267 269 +2 Lines 39189 39483 +294 ========================================= + Hits 12828 13044 +216 - Misses 24539 24593 +54 - Partials 1822 1846 +24
Continue to review full report at Codecov.
|
It is ready for review. |
models/lfs_lock.go Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... 2017 The Gitea ... ?
models/lfs_lock.go Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong order
models/lfs_lock.go Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lfock -> lock
models/lfs_lock.go Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use created
is enough, then line 28 -> 30 and line 36 could be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I base myself on other models like :
gitea/models/issue_stopwatch.go
Line 24 in a8717e5
s.CreatedUnix = time.Now().Unix() |
After review more of those, I might be needed adding
xorm:"INDEX created"
on created like :Line 23 in aa962de
CreatedUnix int64 `xorm:"INDEX created"` |
After adding that, does I need ?
Line 32 in aa962de
t.Created = time.Unix(t.CreatedUnix, 0).Local() |
I will totally follow you on xorm since you will know more about it and maybe (in another PR) we should clean other models with such pattern.
models/lfs_lock.go Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe store a lower column?
models/lfs_lock.go Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IsLFSLockExist
has been invoked on GetLFSLock
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lunny To be sure, I would better use directly GetLFSLock and check if !IsErrLFSLockNotExist(err)
?
models/lfs_lock.go Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return
964e7ee
to 3015595
Compare Save a little of memory and cpu time.
RepoID int64 `xorm:"INDEX"` | ||
Owner *User `xorm:"-"` | ||
OwnerID int64 `xorm:"INDEX"` | ||
Path string `xorm:"TEXT"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And maybe Path
should be unique with RepoID
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and that make me think that I should also use filepath.Clean before adding a entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done + add not null constraint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert back the uniqueness since mysql need a fixed size to index uniquess on field and path is a TEXT field. Uniqueness is preserve by code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path
could be xorm:"varchar(1024)"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after looking at it linux limits path length to 4096
29d0c3a
to 2988c10
Compare 1af481d
to 40b3cbb
Compare b543065
to ca344b5
Compare 7798ef5
to ab0a3eb
Compare d74a2ed
to 0180efa
Compare LGTM |
@sapk please resolve vendor conflict |
@lafriks done |
LGTM |
Resolve #2725