Repository navigation
fix(git): check a commit out aside, and keep the cache of remote resources in a directory for each kind - #14475
Merged
Merged
Conversation
…tory of the cache for Git A commit was checked out directly into its directory of the cache, which was then taken for complete as soon as it existed: a run interrupted during the fetch or the checkout left a partial directory that every later run used. The checkout is now made in a directory of its own and renamed to the one of the commit once it is complete, so the directory of a commit is never a partial checkout, and no file beside it is needed to tell. Checkouts live in a "git" directory of the cache, and what earlier releases left at the root of the cache is no longer looked for. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
…the cache The cache of remote resources now has one directory for each kind of resource: the checkouts of Git repositories are in "git", and the extracted OCI artifacts are in "oci" rather than at the root of the cache. What earlier releases left at the root of the cache is no longer looked for: an artifact is pulled again the first time it is used. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
docker-agent
reviewed
Nov 6, 2026
docker-agent
left a comment
Contributor
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
docker-agent
reviewed
Nov 6, 2026
docker-agent
left a comment
Contributor
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
3 tasks
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.
What this PR does, in one sentence
The cache of remote resources now has one directory for each kind of resource,
git/andoci/, and a Git checkout is placed in its directory only once it is complete.Context
This follows #14462, which made the OCI loader place an extracted artifact in the cache only once it is complete. This PR applies the equivalent fix to the Git loader, and gives the two kinds of resource the same layout in the cache.
Compose keeps what it fetches for a remote Compose file in a cache, one directory for each commit or digest. The two loaders do not do it the same way: extracted OCI artifacts sit at the root of the cache, and Git checkouts sit there too, next to them.
The Git loader also checks a commit out directly into its directory, and takes the directory for a valid entry as soon as it exists. A run interrupted during the fetch or the checkout (Ctrl-C, a dropped connection, a killed process) leaves a partial directory, and every later run uses it, with no sign that something is missing.
What the PR brings
<cache>/git/<sha>and extracted OCI artifacts in<cache>/oci/<digest>, so the cache has the same structure for both.Not changed: how a reference is resolved to a commit or a digest, what is checked out or extracted, the offline behavior, and the files that are loaded.
One consequence: what earlier releases left at the root of the cache is no longer looked for, so a remote resource is fetched again the first time it is used after the upgrade. The old directories are not removed.
Separating the cache by kind of remote also makes it easier to purge the historical data later. What earlier releases cached cannot be relied on, since it may be incomplete, and it now sits at the root of the cache, apart from the
git/andoci/directories, so it can be told from what the current code writes and removed without touching it.🤖 Generated with Claude Code