-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Support querystring form Git URLs #6172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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>
@@ -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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fragment
needs explanation
There was a problem hiding this comment.
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>
51a677f
to
1ef2851
Compare
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 |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
} | ||
gf.SubDir = v[0] | ||
case "checksum", "commit": | ||
gf.Checksum = v[0] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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? 😅
There was a problem hiding this comment.
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.
supersedes #5974
fixes #4905