Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git v2 client: keep the primary clone up to date
The primary clone can get "stale" if it doesn't keep up with the changes going into the upstream remote. Staleness can result in a performance penalty for EnsureFreshSecondary(), because it would need to fetch more objects to get to the commit SHAs specified in repoOpts.FetchCommits. Git clients that are not using `repoOpts.FetchCommits` cannot get stale, because they invoke the (expensive) RemoteUpdate() call on the primary clone which fetches all refs. However, the primary clones for inrepoconfigs can indeed get stale because it uses `repoOpts.FetchCommits` to do targeted fetches only for the secondary clone since bdd601c (git v2 client for inrepoconfig: allow targeted fetches (2nd attempt), 2023-08-22). Allow updating the primary clone with a new PrimaryCloneUpdateCommits field to periodically update the primary clone with new commits. For inrepoconfigs, we only specify the baseSHA because it may be that the headSHAs never get merged into the base (perhaps the PR gets rejected or abandoned).
- Loading branch information