vendor: github.com/moby/buildkit@master 9b6f60ac8bf9
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
+14
@@ -212,3 +212,17 @@ func (gf *GitRef) loadQuery(query url.Values) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// FragmentFormat returns a simplified git URL in fragment format with only ref.
|
||||
// If the URL cannot be parsed, the original string is returned with false.
|
||||
func FragmentFormat(remote string) (string, bool) {
|
||||
gitRef, _, err := ParseGitRef(remote)
|
||||
if err != nil || gitRef == nil {
|
||||
return remote, false
|
||||
}
|
||||
u := gitRef.Remote
|
||||
if gitRef.Ref != "" {
|
||||
u += "#" + gitRef.Ref
|
||||
}
|
||||
return u, true
|
||||
}
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ var supportedProtos = map[string]struct{}{
|
||||
|
||||
var protoRegexp = regexp.MustCompile(`^[a-zA-Z0-9]+://`)
|
||||
|
||||
// URL is a custom URL type that points to a remote Git repository.
|
||||
// GitURL is a custom URL type that points to a remote Git repository.
|
||||
//
|
||||
// URLs can be parsed from both standard URLs (e.g.
|
||||
// "https://github.com/moby/buildkit.git"), as well as SCP-like URLs (e.g.
|
||||
|
||||
Reference in New Issue
Block a user