mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 18:10:59 +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::")
|
||||
|
||||
scheme, n := extractScheme(n)
|
||||
if scheme == "file://" || scheme == "gh:" {
|
||||
// We support gh: assuming authors use it as a github shorthand, specified in .gitconfig.
|
||||
if scheme == "file://" {
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -264,7 +262,7 @@ func validHostSpecParsed(scheme, username, host string) bool {
|
||||
}
|
||||
|
||||
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 {
|
||||
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
|
||||
// that are unintentionally supported.
|
||||
var schemeAuthority = []struct{ raw, normalized string }{
|
||||
{"gh:", "gh:"},
|
||||
{"GH:", "gh:"},
|
||||
{"gitHub.com/", "https://github.com/"},
|
||||
{"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",
|
||||
"url lacks host",
|
||||
},
|
||||
"mysterious gh: prefix previously supported is no longer handled": {
|
||||
"gh:org/repo",
|
||||
"url lacks orgRepo",
|
||||
},
|
||||
}
|
||||
|
||||
for name, testCase := range badData {
|
||||
|
||||
@@ -226,10 +226,6 @@ func TestLocRootPath_URLComponents(t *testing.T) {
|
||||
urlf: "file:///var/run/repo//%s?ref=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": {
|
||||
urlf: "https://[2001:4860:4860::8888]/org/repo//%s?ref=value",
|
||||
path: simpleJoin(t, "2001:4860:4860::8888", "org", "repo", "value"),
|
||||
|
||||
Reference in New Issue
Block a user