git context: fix support for empty git ref with subdir #3596
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.
fixes docker/buildx#1604
Git context detection in the frontend
buildkit/frontend/dockerfile/builder/build.go
Lines 700 to 703 in ecc5937
does not match
myrepo.git#:myfolder
but should be supported.Also adds more test cases to be sure we don't miss anything else.
Looking at our docs in https://docs.docker.com/build/building/context/#git-repositories
@dvdksn "Commit Used" for
myrepo.git
andmyrepo.git#:myfolder
should be insteaddefault branch
imo.I also wonder if we should mutualize the logic from
buildkit/source/gitidentifier.go
Lines 23 to 54 in ecc5937
buildkit/util/gitutil/git_ref.go
Lines 51 to 95 in ecc5937