Skip to content

Commit 7de3943

Browse files
authored
fix(2952): Allow colon to be used in root directory (#96)
1 parent ee1f325 commit 7de3943

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff 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 = /^~pr:(.*)$/;
226229
const checkoutConfig = {

test/index.test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff 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, {

0 commit comments

Comments
 (0)