@@ -169,27 +169,24 @@ class PushTask {
169169 // Get the repository data for the project.
170170 let repositoryUrl = DevConfig . get ( branchData . project + '.repositoryUrl' ) ;
171171 let diffUrlTemplate = DevConfig . get ( branchData . project + '.diffUrlTemplate' , '' ) ;
172- let remoteUrl ;
173172
174173 if ( ! repositoryUrl ) {
175174 // Calculate the repositoryUrl based on the remote URL.
176- remoteUrl = await Git . getRemoteUrl ( remote ) ;
177-
178- repositoryUrl = remoteUrl . replace ( / ^ h t t p s ? : \/ \/ / , 'git://' ) ;
179- if ( ! repositoryUrl . match ( / \. g i t $ / ) ) {
180- repositoryUrl += '.git' ;
181- }
175+ repositoryUrl = await Git . getRemoteUrl ( remote ) ;
182176 }
183177
184- if ( ! diffUrlTemplate ) {
185- // Calculate the diffUrlTemplate based on the remote URL.
186- if ( ! remoteUrl ) {
187- remoteUrl = await Git . getRemoteUrl ( remoteUrl ) ;
188- }
178+ // Make sure the repository URL uses the regular format.
179+ repositoryUrl = repositoryUrl . replace ( / ^ ( g i t @ | g i t : \/ \/ ) / , 'https://' )
180+ . replace ( / \. g i t $ / , '' )
181+ . replace ( 'github.com:' , 'github.com/' ) ;
189182
190- diffUrlTemplate = remoteUrl + '/compare/%headcommit%...%branch%' ;
183+ if ( ! diffUrlTemplate ) {
184+ diffUrlTemplate = Utils . concatenatePaths ( [ repositoryUrl , 'compare/%headcommit%...%branch%' ] ) ;
191185 }
192186
187+ // Now create the git URL for the repository.
188+ const repositoryGitUrl = repositoryUrl . replace ( / ^ h t t p s ? : \/ \/ / , 'git://' ) + '.git' ;
189+
193190 // Search HEAD commit to put in the diff URL.
194191 console . log ( 'Searching for head commit...' ) ;
195192 let headCommit = await Git . getHeadCommit ( branch , branchData ) ;
@@ -209,7 +206,7 @@ class PushTask {
209206
210207 // Update tracker fields.
211208 const updates = { } ;
212- updates [ fieldRepositoryUrl ] = repositoryUrl ;
209+ updates [ fieldRepositoryUrl ] = repositoryGitUrl ;
213210 updates [ fieldBranch ] = branch ;
214211 updates [ fieldDiffUrl ] = diffUrl ;
215212
0 commit comments