@@ -32,6 +32,7 @@ export function getRepoPath(relativePath?: string): string {
32
32
}
33
33
34
34
interface RemoteDetail {
35
+ hostname : string
35
36
protocol : string
36
37
repository : string
37
38
}
@@ -46,18 +47,21 @@ export function getRemoteDetail(remoteUrl: string): RemoteDetail {
46
47
throw new Error ( 'Could not parse GitHub Server name' )
47
48
}
48
49
50
+ const hostname = githubServerMatch [ 1 ]
51
+
49
52
const httpsUrlPattern = new RegExp (
50
- '^https?://.*@?' + githubServerMatch [ 1 ] + '/(.+/.+?)(\\.git)?$' ,
53
+ '^https?://.*@?' + hostname + '/(.+/.+?)(\\.git)?$' ,
51
54
'i'
52
55
)
53
56
const sshUrlPattern = new RegExp (
54
- '^git@' + githubServerMatch [ 1 ] + ':(.+/.+)\\.git$' ,
57
+ '^git@' + hostname + ':(.+/.+)\\.git$' ,
55
58
'i'
56
59
)
57
60
58
61
const httpsMatch = remoteUrl . match ( httpsUrlPattern )
59
62
if ( httpsMatch ) {
60
63
return {
64
+ hostname,
61
65
protocol : 'HTTPS' ,
62
66
repository : httpsMatch [ 1 ]
63
67
}
@@ -66,6 +70,7 @@ export function getRemoteDetail(remoteUrl: string): RemoteDetail {
66
70
const sshMatch = remoteUrl . match ( sshUrlPattern )
67
71
if ( sshMatch ) {
68
72
return {
73
+ hostname,
69
74
protocol : 'SSH' ,
70
75
repository : sshMatch [ 1 ]
71
76
}
@@ -76,10 +81,10 @@ export function getRemoteDetail(remoteUrl: string): RemoteDetail {
76
81
)
77
82
}
78
83
79
- export function getRemoteUrl ( protocol : string , repository : string ) : string {
84
+ export function getRemoteUrl ( protocol : string , hostname : string , repository : string ) : string {
80
85
return protocol == 'HTTPS'
81
- ? `https://github.com /${ repository } `
82
- : `git@github.com :${ repository } .git`
86
+ ? `https://${ hostname } /${ repository } `
87
+ : `git@${ hostname } :${ repository } .git`
83
88
}
84
89
85
90
export function secondsSinceEpoch ( ) : number {
0 commit comments