-
Notifications
You must be signed in to change notification settings - Fork 279
feat(gitter): git commit graph and patch ID caching, affected commits walking #4728
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
base: master
Are you sure you want to change the base?
Conversation
| } | ||
|
|
||
| func loadRepositoryCache(cachePath string) (*pb.RepositoryCache, error) { | ||
| data, err := os.ReadFile(cachePath) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
This path depends on a
user-provided value
| _, err := os.Stat(path.Join(repoPath, ".git")) | ||
| if err != nil { | ||
| if os.IsNotExist(err) { | ||
| deleteLastFetch(url) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
This path depends on a
user-provided value
This path depends on a
user-provided value
| stats, err := os.Stat(archivePath) | ||
| if os.IsNotExist(err) || (err == nil && stats.ModTime().Before(accessTime)) { | ||
| logger.Info("Archiving git blob", slog.String("url", url)) | ||
| // Archive |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
| var newCommits []SHA1 | ||
|
|
||
| // Temp outFile for git log output | ||
| tmpFile, err := os.CreateTemp(r.repoPath, "git-log.out") |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
This path depends on a
user-provided value
| return err | ||
| } | ||
|
|
||
| return os.WriteFile(cachePath, data, 0600) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
This path depends on a
user-provided value
And the start to git enumeration but the graph traversal needs more work
Because it is faster than stdout pipe after some experimentation.
Building on top of #4508 & co.
Key changes:
API updates:
POST /cache: Triggers a clone / fetch and store the computed commit detailsPOST /affected-commits: accepts a list of events and returns the list of affected commits/getgitrenamed toGET /gitWIP:
/affected-commitsshould accept a list of ranges as valid request as wellTo be added in follow-up PR because this is getting big