File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -220,7 +220,10 @@ class ScmBase {
220220 * @return {Promise }
221221 */
222222 getSetupCommand ( o ) {
223- const [ host , , branch , rootDir ] = o . pipeline . scmUri . split ( ':' ) ;
223+ const parts = o . pipeline . scmUri . split ( ':' ) ;
224+ const [ host , , branch , ...rootDirParts ] = parts ;
225+ const rootDir = rootDirParts . join ( ':' ) ;
226+
224227 const [ org , repo ] = o . pipeline . scmRepo . name . split ( '/' ) ;
225228 const prBranchRegex = / ^ ~ p r : ( .* ) $ / ;
226229 const checkoutConfig = {
Original file line number Diff line number Diff line change @@ -306,6 +306,30 @@ describe('index test', () => {
306306 } ) ;
307307 } ) ;
308308
309+ it ( 'returns a command when rootDir with a colon exists' , ( ) => {
310+ config . pipeline . scmUri = 'github.com:12344567:branch:colon:colon' ;
311+ instance . _getCheckoutCommand = o => {
312+ assert . deepEqual ( o , {
313+ branch : 'branch' ,
314+ host : 'github.com' ,
315+ org : 'screwdriver-cd' ,
316+ repo : 'guide' ,
317+ rootDir : 'colon:colon' ,
318+ sha : '12345' ,
319+ prSource : 'branch' ,
320+ prBranchName : 'prBranchName' ,
321+ prRef : 'prRef' ,
322+ scmContext : 'github:github.com'
323+ } ) ;
324+
325+ return Promise . resolve ( { name : 'sd-checkout-code' , command : 'stuff' } ) ;
326+ } ;
327+
328+ return instance . getSetupCommand ( config ) . then ( command => {
329+ assert . equal ( command , 'stuff' ) ;
330+ } ) ;
331+ } ) ;
332+
309333 it ( 'returns a command for pr' , ( ) => {
310334 instance . _getCheckoutCommand = o => {
311335 assert . deepEqual ( o , {
You can’t perform that action at this time.
0 commit comments