-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Set default lfs content path to data/lfs #2521
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2521 +/- ##
=======================================
Coverage 26.91% 26.91%
=======================================
Files 87 87
Lines 17286 17286
=======================================
Hits 4652 4652
Misses 11955 11955
Partials 679 679 Continue to review full report at Codecov.
|
modules/setting/setting.go
Outdated
@@ -737,6 +737,9 @@ func NewContext() { | |||
} | |||
|
|||
if LFS.StartServer { | |||
if LFS.ContentPath == "" { |
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 think this needs something like:
sec = Cfg.Section("lfs")
LFS.ContentPath = sec.Key("CONTENT_PATH").MustString(path.Join(AppDataPath, "lfs"))
if !filepath.IsAbs(LFS.ContentPath) {
LFS.ContentPath = filepath.Join(workDir, LFS.ContentPath)
}
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, you're right. Need to check if absolute path. Think the first bit is ok tho?
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.
To be more consistent with other code I think it should be something like I gave example. Only thing I also have wrong for FS paths better is to use filepath
methods not path
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.
Fair enough 👍 I have updated accordingly :)
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.
@cez81 did you forgot to do git push?
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.
Forgot to commit... :/
fc70763
to
b3253b0
Compare
log.Fatal(4, "Failed to map LFS settings: %v", err) | ||
} | ||
LFS.ContentPath = sec.Key("LFS_CONTENT_PATH").MustString(filepath.Join(AppDataPath, "lfs")) |
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.
either move this line after if LFS.StartServer {
or move if ...IsAbs(...
after this line so that both these lines are together
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.
👍
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.
Set it like this instead: https://github.com/cez81/gitea/blob/d766d0c4e064bf7f66098123f39d15c2dc67e415/modules/setting/setting.go#L116
}{
ContentPath: "data/lfs"
}
As seen for example here: https://github.com/cez81/gitea/blob/d766d0c4e064bf7f66098123f39d15c2dc67e415/modules/setting/setting.go#L214
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.
we really need to decide how to specify default value in code. We have at least two different ways to do that that is not very good :)
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 think setting it like this is better. Don't want to hard code the data folder, right?
LGTM |
Make LG-TM work |
b8a1feb
to
0bbe2a4
Compare
LGTM |
As title.
gitea/conf/app.ini
Line 161 in d766d0c
Fix #2508