mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-09-15 12:18:57 +00:00
Stop handling mysterious gh: prefix in remote URLs
This commit is contained in:
@@ -234,10 +234,8 @@ func extractHost(n string) (string, string) {
|
|||||||
n, _ = trimPrefixIgnoreCase(n, "git::")
|
n, _ = trimPrefixIgnoreCase(n, "git::")
|
||||||
|
|
||||||
scheme, n := extractScheme(n)
|
scheme, n := extractScheme(n)
|
||||||
if scheme == "file://" || scheme == "gh:" {
|
if scheme == "file://" {
|
||||||
// We support gh: assuming authors use it as a github shorthand, specified in .gitconfig.
|
|
||||||
// The file protocol specifies an absolute path to a local git repo. There is no host.
|
// The file protocol specifies an absolute path to a local git repo. There is no host.
|
||||||
// In both cases, we return the scheme and the rest of the url.
|
|
||||||
return scheme, n
|
return scheme, n
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,7 +262,7 @@ func validHostSpecParsed(scheme, username, host string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func extractScheme(s string) (string, string) {
|
func extractScheme(s string) (string, string) {
|
||||||
for _, prefix := range []string{"gh:", "ssh://", "https://", "http://", "file://"} {
|
for _, prefix := range []string{"ssh://", "https://", "http://", "file://"} {
|
||||||
if rest, found := trimPrefixIgnoreCase(s, prefix); found {
|
if rest, found := trimPrefixIgnoreCase(s, prefix); found {
|
||||||
return prefix, rest
|
return prefix, rest
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ func TestNewRepoSpecFromUrl_Permute(t *testing.T) {
|
|||||||
// we probably stil don't want to break backwards compatibility for things
|
// we probably stil don't want to break backwards compatibility for things
|
||||||
// that are unintentionally supported.
|
// that are unintentionally supported.
|
||||||
var schemeAuthority = []struct{ raw, normalized string }{
|
var schemeAuthority = []struct{ raw, normalized string }{
|
||||||
{"gh:", "gh:"},
|
|
||||||
{"GH:", "gh:"},
|
|
||||||
{"gitHub.com/", "https://github.com/"},
|
{"gitHub.com/", "https://github.com/"},
|
||||||
{"github.com:", "https://github.com/"},
|
{"github.com:", "https://github.com/"},
|
||||||
{"http://github.com/", "https://github.com/"},
|
{"http://github.com/", "https://github.com/"},
|
||||||
@@ -126,6 +124,10 @@ func TestNewRepoSpecFromUrlErrors(t *testing.T) {
|
|||||||
"git@https://github.com/org/repo.git//path",
|
"git@https://github.com/org/repo.git//path",
|
||||||
"url lacks host",
|
"url lacks host",
|
||||||
},
|
},
|
||||||
|
"mysterious gh: prefix previously supported is no longer handled": {
|
||||||
|
"gh:org/repo",
|
||||||
|
"url lacks orgRepo",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, testCase := range badData {
|
for name, testCase := range badData {
|
||||||
|
|||||||
@@ -226,10 +226,6 @@ func TestLocRootPath_URLComponents(t *testing.T) {
|
|||||||
urlf: "file:///var/run/repo//%s?ref=value",
|
urlf: "file:///var/run/repo//%s?ref=value",
|
||||||
path: simpleJoin(t, FileSchemeDir, "var", "run", "repo", "value"),
|
path: simpleJoin(t, FileSchemeDir, "var", "run", "repo", "value"),
|
||||||
},
|
},
|
||||||
"gh_shorthand": {
|
|
||||||
urlf: "gh:org/repo//%s?ref=value",
|
|
||||||
path: simpleJoin(t, "gh", "org", "repo", "value"),
|
|
||||||
},
|
|
||||||
"IPv6": {
|
"IPv6": {
|
||||||
urlf: "https://[2001:4860:4860::8888]/org/repo//%s?ref=value",
|
urlf: "https://[2001:4860:4860::8888]/org/repo//%s?ref=value",
|
||||||
path: simpleJoin(t, "2001:4860:4860::8888", "org", "repo", "value"),
|
path: simpleJoin(t, "2001:4860:4860::8888", "org", "repo", "value"),
|
||||||
|
|||||||
Reference in New Issue
Block a user