-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
77 changed files
with
220 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,15 +78,15 @@ func (x *RepoSpec) Cleaner(fSys filesys.FileSystem) func() error { | |
return func() error { return fSys.RemoveAll(x.Dir.String()) } | ||
} | ||
|
||
// NewRepoSpecFromUrl parses git-like urls. | ||
// NewRepoSpecFromURL parses git-like urls. | ||
// From strings like [email protected]:someOrg/someRepo.git or | ||
// https://github.com/someOrg/someRepo?ref=someHash, extract | ||
// the parts. | ||
func NewRepoSpecFromUrl(n string) (*RepoSpec, error) { | ||
func NewRepoSpecFromURL(n string) (*RepoSpec, error) { | ||
if filepath.IsAbs(n) { | ||
return nil, fmt.Errorf("uri looks like abs path: %s", n) | ||
} | ||
host, orgRepo, path, gitRef, gitSubmodules, suffix, gitTimeout := parseGitUrl(n) | ||
host, orgRepo, path, gitRef, gitSubmodules, suffix, gitTimeout := parseGitURL(n) | ||
if orgRepo == "" { | ||
return nil, fmt.Errorf("url lacks orgRepo: %s", n) | ||
} | ||
|
@@ -108,9 +108,8 @@ const ( | |
// From strings like [email protected]:someOrg/someRepo.git or | ||
// https://github.com/someOrg/someRepo?ref=someHash, extract | ||
// the parts. | ||
func parseGitUrl(n string) ( | ||
func parseGitURL(n string) ( | ||
host string, orgRepo string, path string, gitRef string, gitSubmodules bool, gitSuff string, gitTimeout time.Duration) { | ||
|
||
if strings.Contains(n, gitDelimiter) { | ||
index := strings.Index(n, gitDelimiter) | ||
// Adding _git/ to host | ||
|
@@ -229,7 +228,7 @@ func parseHostSpec(n string) (string, string) { | |
if strings.HasSuffix(host, p) { | ||
i := strings.Index(n, "/") | ||
if i > -1 { | ||
host = host + n[0:i+1] | ||
host += n[0 : i+1] | ||
n = n[i+1:] | ||
} | ||
break | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ var hostNamesRawAndNormalized = [][]string{ | |
{"[email protected]/", "[email protected]:"}, | ||
} | ||
|
||
func makeUrl(hostFmt, orgRepo, path, href string) string { | ||
func makeURL(hostFmt, orgRepo, path, href string) string { | ||
if len(path) > 0 { | ||
orgRepo = filepath.Join(orgRepo, path) | ||
} | ||
|
@@ -56,8 +56,8 @@ func TestNewRepoSpecFromUrl(t *testing.T) { | |
for _, orgRepo := range orgRepos { | ||
for _, pathName := range pathNames { | ||
for _, hrefArg := range hrefArgs { | ||
uri := makeUrl(hostRaw, orgRepo, pathName, hrefArg) | ||
rs, err := NewRepoSpecFromUrl(uri) | ||
uri := makeURL(hostRaw, orgRepo, pathName, hrefArg) | ||
rs, err := NewRepoSpecFromURL(uri) | ||
if err != nil { | ||
t.Errorf("problem %v", err) | ||
} | ||
|
@@ -99,7 +99,7 @@ var badData = [][]string{ | |
|
||
func TestNewRepoSpecFromUrlErrors(t *testing.T) { | ||
for _, tuple := range badData { | ||
_, err := NewRepoSpecFromUrl(tuple[0]) | ||
_, err := NewRepoSpecFromURL(tuple[0]) | ||
if err == nil { | ||
t.Error("expected error") | ||
} | ||
|
@@ -191,7 +191,7 @@ func TestNewRepoSpecFromUrl_CloneSpecs(t *testing.T) { | |
} | ||
for tn, tc := range testcases { | ||
t.Run(tn, func(t *testing.T) { | ||
rs, err := NewRepoSpecFromUrl(tc.input) | ||
rs, err := NewRepoSpecFromURL(tc.input) | ||
assert.NoError(t, err) | ||
assert.Equal(t, tc.cloneSpec, rs.CloneSpec(), "cloneSpec mismatch") | ||
assert.Equal(t, tc.absPath, rs.AbsPath(), "absPath mismatch") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.