-
Notifications
You must be signed in to change notification settings - Fork 5
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
2 changed files
with
19 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,7 @@ func parseSCPLike(endpoint string) (*Endpoint, bool) { | |
Host: host, | ||
Port: port, | ||
Path: path, | ||
raw: endpoint, | ||
}, true | ||
} | ||
|
||
|
@@ -110,6 +111,8 @@ type Endpoint struct { | |
ExtraHeader map[string]string | ||
// ExtraEnv extra env | ||
ExtraEnv map[string]string | ||
// raw endpoint: only scp like url --> [email protected]:namespace/repo | ||
raw string | ||
} | ||
|
||
type Options struct { | ||
|
@@ -226,8 +229,11 @@ var defaultPorts = map[string]int{ | |
"ssh": 22, | ||
} | ||
|
||
// String returns a string representation of the Git URL. | ||
// String returns a string representation of the zeta URL. | ||
func (u *Endpoint) String() string { | ||
if len(u.raw) != 0 { | ||
return u.raw | ||
} | ||
var buf bytes.Buffer | ||
if u.Protocol != "" { | ||
buf.WriteString(u.Protocol) | ||
|
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 |
---|---|---|
|
@@ -44,6 +44,7 @@ func TestEndpointIsURL(t *testing.T) { | |
"http://xxxx", | ||
"git@xxxx", | ||
"zeta@zzzz", | ||
"[email protected]:jack/zeta-demo", | ||
} | ||
for _, s := range sss { | ||
fmt.Fprintf(os.Stderr, "%s %v\n", s, hasScheme(s)) | ||
|
@@ -63,6 +64,16 @@ func TestParseEndpoint(t *testing.T) { | |
fmt.Fprintf(os.Stderr, "Parse: %v\n", err) | ||
continue | ||
} | ||
fmt.Fprintf(os.Stderr, "endpoint: %v protocol: %s\n", e, e.Protocol) | ||
fmt.Fprintf(os.Stderr, "endpoint: %v protocol: %s raw: %s\n", e, e.Protocol, s) | ||
} | ||
} | ||
|
||
func TestEndpoint(t *testing.T) { | ||
raw := "[email protected]:jack/zeta-demo" | ||
e, err := NewEndpoint(raw, nil) | ||
if err != nil { | ||
fmt.Fprintf(os.Stderr, "Parse: %v\n", err) | ||
return | ||
} | ||
fmt.Fprintf(os.Stderr, "endpoint: %v protocol: %s raw: %s\n", e, e.Protocol, raw) | ||
} |