mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-30 18:01:21 +00:00
Rewrite remoteload_test integration tests (#4783)
* Better error message when git clone fails * support file:// URLs * rewrite remoteload_test * lint and test fix * fixes for kverey's comments * document file:// remote load * replace assert with require where appropriate * add tests for file:// without git suffix * fixes plus pr review from natasha * fixes for review, lint * revert changes to error handling * fix skipped test
This commit is contained in:
@@ -119,8 +119,12 @@ func parseGitURL(n string) (
|
||||
return
|
||||
}
|
||||
host, n = parseHostSpec(n)
|
||||
gitSuff = gitSuffix
|
||||
isLocal := strings.HasPrefix(host, "file://")
|
||||
if !isLocal {
|
||||
gitSuff = gitSuffix
|
||||
}
|
||||
if strings.Contains(n, gitSuffix) {
|
||||
gitSuff = gitSuffix
|
||||
index := strings.Index(n, gitSuffix)
|
||||
orgRepo = n[0:index]
|
||||
n = n[index+len(gitSuffix):]
|
||||
@@ -131,6 +135,19 @@ func parseGitURL(n string) (
|
||||
return
|
||||
}
|
||||
|
||||
if isLocal {
|
||||
if idx := strings.Index(n, "//"); idx > 0 {
|
||||
orgRepo = n[:idx]
|
||||
n = n[idx+2:]
|
||||
path, gitRef, gitTimeout, gitSubmodules = peelQuery(n)
|
||||
return
|
||||
}
|
||||
path, gitRef, gitTimeout, gitSubmodules = peelQuery(n)
|
||||
orgRepo = path
|
||||
path = ""
|
||||
return
|
||||
}
|
||||
|
||||
i := strings.Index(n, "/")
|
||||
if i < 1 {
|
||||
path, gitRef, gitTimeout, gitSubmodules = peelQuery(n)
|
||||
@@ -200,7 +217,7 @@ func parseHostSpec(n string) (string, string) {
|
||||
// Start accumulating the host part.
|
||||
for _, p := range []string{
|
||||
// Order matters here.
|
||||
"git::", "gh:", "ssh://", "https://", "http://",
|
||||
"git::", "gh:", "ssh://", "https://", "http://", "file://",
|
||||
"git@", "github.com:", "github.com/"} {
|
||||
if len(p) < len(n) && strings.ToLower(n[:len(p)]) == p {
|
||||
n = n[len(p):]
|
||||
|
||||
Reference in New Issue
Block a user