-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Use gitrepo.GetTreePathLatestCommit to get file lastest commit instead from latest commit cache #32987
base: main
Are you sure you want to change the base?
Use gitrepo.GetTreePathLatestCommit to get file lastest commit instead from latest commit cache #32987
Conversation
7162f0c
to
e0f7b89
Compare
modules/gitrepo/tree_path.go
Outdated
"code.gitea.io/gitea/modules/git" | ||
) | ||
|
||
func GetTreePathLatestCommit(ctx context.Context, repo Repository, commitID, treePath string) (*git.Commit, error) { |
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.
Why in gitrepo
package but not git
package?
Do you have a clear plan or roadmap for these two packages? Or just keep making them more messy like other legacy/problematic 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.
My plan is that modules/git
will be the low level of modules/gitrepo
. modules/gitrepo
is only for managed repositories but modules/git
will be a general git wrap library which can be used for managed repositories or temporary repositories. And in modules/gitrepo
, the repository can be reused by context. There is a description in PR #28937 .
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.
Then you shouldn't put "git command calls" in "gitrepo", right?
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.
If you are not able to remember the plan&design, please please please write documents and comments, in case you would forget how to write the right code next time.
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.
Why do you think gitrepo
should not invoke git command calls
? Since git command calls
are all the basics of almost all git operations, that will be unavoidable.
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.
modules/gitrepo
is only for managed repositories butmodules/git
will be a general git wrap library which can be used for managed repositories or temporary repositories.
It is answered by your description. Then the basic git operations should be provided by the "general git library", but not by a context-repo-manager.
The latest commit cache is currently used only for listing tree files. However, a cold start may take longer than directly invoking the Git command. This PR addresses the issue of slow response times when accessing raw files, improving performance in such scenarios.