Skip to content

Conversation

@Ly-Joey
Copy link
Contributor

@Ly-Joey Ly-Joey commented Feb 3, 2026

Building on top of #4508 & co.

Key changes:

  • Added foundational structure to save commit details to disk
  • We now parse full git history into in-memory graph for commit traversal
  • Parallelised patch ID calculation. They are loaded from the cache, meaning subsequent requests to the same repo only need to compute patch IDs for new commits.

API updates:

  • POST /cache: Triggers a clone / fetch and store the computed commit details
  • POST /affected-commits: accepts a list of events and returns the list of affected commits
  • /getgit renamed to GET /git

WIP:

  • Check if a repoistory exist (/git-good)
  • Resolve refs to commit hash
  • /affected-commits should accept a list of ranges as valid request as well

To be added in follow-up PR because this is getting big

}

func loadRepositoryCache(cachePath string) (*pb.RepositoryCache, error) {
data, err := os.ReadFile(cachePath)

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
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

This path depends on a
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

This path depends on a
user-provided value
.
@Ly-Joey Ly-Joey changed the title Gitter feat(gitter): git commit graph and patch ID caching, affected commits walking Feb 9, 2026
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

This path depends on a
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

This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant