Skip to content

Commit

Permalink
fix: Remove hg command from remoteAddr
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasrockhu committed Jul 20, 2021
1 parent 07c7c3b commit f45dc7f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
9 changes: 3 additions & 6 deletions src/helpers/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@ function parseSlug(slug) {
function parseSlugFromRemoteAddr(remoteAddr) {
let slug = ''
if (!remoteAddr) {
remoteAddr = childProcess
remoteAddr = (childProcess
.spawnSync('git', [
'config',
'--get',
'remote.origin.url',
'||',
'echo',
"''",
])
.stdout.toString()
]).stdout || '')
.toString()
.trimRight()
}
if (remoteAddr) {
Expand Down
17 changes: 8 additions & 9 deletions test/providers/provider_gitlabci.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ describe('GitLabCI Params', () => {
service: 'gitlab',
slug: '',
}
const spawnSync = td.replace(childProcess, 'spawnSync')
td.when(
spawnSync('git', [
'config',
'--get',
'remote.origin.url',
]),
).thenReturn({ stdout: '' })
const params = providerGitLabci.getServiceParams(inputs)
expect(params).toMatchObject(expected)
})
Expand Down Expand Up @@ -132,9 +140,6 @@ describe('GitLabCI Params', () => {
'config',
'--get',
'remote.origin.url',
'||',
'echo',
"''",
]),
).thenReturn({ stdout: 'https://gitlab.com/testOrg/testRepo.git' })

Expand All @@ -150,9 +155,6 @@ describe('GitLabCI Params', () => {
'config',
'--get',
'remote.origin.url',
'||',
'echo',
"''",
]),
).thenReturn({ stdout: '[email protected]:/' })

Expand All @@ -168,9 +170,6 @@ describe('GitLabCI Params', () => {
'config',
'--get',
'remote.origin.url',
'||',
'echo',
"''",
]),
).thenReturn({ stdout: '' })

Expand Down
8 changes: 8 additions & 0 deletions test/providers/provider_jenkinsci.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ describe('Jenkins CI Params', () => {
service: 'jenkins',
slug: '',
}
const spawnSync = td.replace(childProcess, 'spawnSync')
td.when(
spawnSync('git', [
'config',
'--get',
'remote.origin.url',
]),
).thenReturn({ stdout: '' })
const params = providerJenkinsci.getServiceParams(inputs)
expect(params).toMatchObject(expected)
})
Expand Down

0 comments on commit f45dc7f

Please sign in to comment.