Skip to content

Conversation

tonistiigi
Copy link
Member

@tonistiigi tonistiigi commented Aug 28, 2025

supersedes #5974
fixes #4905

AkihiroSuda and others added 2 commits August 28, 2025 13:50
Fix issue 4905, but the syntax differs from the original proposal.

The document will be added to
https://github.com/docker/docs/blob/main/content/manuals/build/concepts/context.md#url-fragments

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@AkihiroSuda
Copy link
Member

fixes #4509

Probably you meant #4905

@@ -249,7 +249,7 @@ const (
//
// By default the git repository is cloned with `--depth=1` to reduce the amount of data downloaded.
// Additionally the ".git" directory is removed after the clone, you can keep ith with the [KeepGitDir] [GitOption].
func Git(url, ref string, opts ...GitOption) State {
func Git(url, fragment string, opts ...GitOption) State {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fragment needs explanation

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that there is no functional change in here. The previous var was incorrectly named; it was actually a ref:substring pair.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@tonistiigi tonistiigi marked this pull request as ready for review August 29, 2025 02:25
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>

tcases := []tcase{
{
// if this commit is already cached then this will work and ignore tag atm because tag name has no influence to the output
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AkihiroSuda Bit unexpected, but I don't think there is another way. This is not any new behavior from querystring but same for --checksum.

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda merged commit 99a9103 into moby:master Aug 29, 2025
194 of 195 checks passed
@AkihiroSuda AkihiroSuda added this to the v0.24.0 milestone Aug 29, 2025
@AkihiroSuda
Copy link
Member

}
gf.SubDir = v[0]
case "checksum", "commit":
gf.Checksum = v[0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a weird word to use for a commit hash 🤔 it is technically a checksum, but I don't think there's really any prior art for calling one of them "checksum" is there?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ADD --checksum is the flag for the current version of this behavior (since DF 1.16 for Git). Note that this is not what is used to check out the reference, but for the validation of the ref/tag/branch.

case "tag":
tag = v[0]
case "branch":
branch = v[0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess #4905 (comment) wasn't convincing enough to drop branch and tag in favor of just ref? 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use ref and you can set it to refs/tags/* or refs/heads/* manually. tag and branch are added for convenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: csv syntax for git repos
3 participants