Add cache and parallel run to Git Count Contributors#701
Open
Add cache and parallel run to Git Count Contributors#701
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

feat(git): Add parallel scanning and caching to Git Count Contributors
Summary
Introduces parallel repository scanning and a file-based cache layer to the
git count-contributorscommand, significantly improving performance for large organizations with many repositories. Repositories are now scanned concurrently (configurable via--threads, default 10) and results are cached to disk (configurable via--cache-validity, default 3 days) to avoid redundant API calls on repeated runs.Changes
scanAndCollectCommitsInfoto scan repositories concurrently usinggofrog/parallel.Runner. Each repo is scanned independently, and results are merged after all tasks complete.cache.gomodule persists per-repo scan results as JSON files under~/.jfrog/contributors-cache/<hash>/. Cache entries are keyed by a SHA256 hash of (scm-type, scm-api-url, owner, months) to avoid collisions. Writes are atomic (tmp + rename).--cache-validity— number of days a cached result remains valid (0 = skip cache, default 3).--threads— number of parallel threads for scanning (default 10).repoScanResultandvcsServerScanResultstructs to cleanly aggregate parallel results, along withmergeContributors,mergeDetailedContributors, andmergeDetailedReposhelper functions.GetContributorsCacheDir()inutils/paths.go.mockVcsClienttest double.Files changed
cli/docs/flags.goCacheValidity,GitThreadsflagscli/gitcommands.gocommands/git/contributors/cache.gocommands/git/contributors/cache_test.gocommands/git/contributors/countcontributors.gocommands/git/contributors/countcontributors_test.gocommands/git/contributors/mock_vcs_client_test.goutils/paths.goGetContributorsCacheDirhelperTesting
Notes
monthsparameter in the key, so changing--monthsautomatically invalidates stale cache.--cache-validity 0fully bypasses caching (no file I/O at all).devbranch.go vet ./....go fmt ./....