Skip to content

Short-circuit git source updates for unchanged remote commits - #11

Open
Lowerce wants to merge 2 commits into
VintLin:mainfrom
Lowerce:main
Open

Short-circuit git source updates for unchanged remote commits#11
Lowerce wants to merge 2 commits into
VintLin:mainfrom
Lowerce:main

Conversation

@Lowerce

@Lowerce Lowerce commented Aug 6, 2026

Copy link
Copy Markdown

This pull request introduces an optimization to the source update process for Git sources, ensuring that sources are not unnecessarily refreshed if the remote commit has not changed. It also adds supporting functionality and tests for reading the remote HEAD commit from a Git repository.

Optimization for Git source updates:

  • The SourceAuthorityService now checks the remote HEAD commit for Git sources before performing a refresh. If the remote commit matches the locked commit, the refresh is skipped, improving efficiency.
  • Added the helper method readLockedCommitSha to extract the commit SHA from a SourceRevision object.

New functionality for reading remote commits:

  • Implemented readGitRemoteHeadCommit in SourceCheckoutService to retrieve the remote HEAD (or branch) commit SHA from a Git locator, with network retry logic.

Test coverage:

  • Added a test to verify that updateSources skips the refresh if the remote commit is unchanged, and that prepareSourceCheckout is not called in this case.
  • Added a test for readGitRemoteHeadCommit to confirm it correctly reads the remote HEAD commit from a Git repository.
  • Updated test imports to include vi for mocking.

Copilot AI and others added 2 commits August 6, 2026 09:25
Co-authored-by: Lowerce <31007839+Lowerce@users.noreply.github.com>
Short-circuit git source updates when remote commit is unchanged
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.

2 participants