1
0
mirror of https://github.com/moby/buildkit.git synced 2025-12-01 16:18:12 +03:00
Files
buildkit/source/git/source.go
Tonis Tiigi 44b1aca26a git: fix caching git commit through multiple refs
This fixes current issue when a Git commit is accessed
multiple times through different refs or ref is added
after commit has already been pulled once.

When keep-git-dir option is true, then program can
try to resolve the current reference via .git directory
and because old cache key was only the git commit, previous
.git directory can be reused without any refs inside.

There is no change to the behavior if keep-git-dir is
false as then requests through multiple refs yield to
identical content.

Only the reference in the user provided identifier is added
to the cache key, and that is the only one that can be
expected in .git because of the shallow fetches. We do not
do extra request to find named refs for a commit SHA if that is
provided in the identifier.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-10-23 16:59:22 -07:00

21 KiB