Skip to content

Commit f45dc7f

Browse files
committed
fix: Remove hg command from remoteAddr
1 parent 07c7c3b commit f45dc7f

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

src/helpers/git.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,13 @@ function parseSlug(slug) {
2424
function parseSlugFromRemoteAddr(remoteAddr) {
2525
let slug = ''
2626
if (!remoteAddr) {
27-
remoteAddr = childProcess
27+
remoteAddr = (childProcess
2828
.spawnSync('git', [
2929
'config',
3030
'--get',
3131
'remote.origin.url',
32-
'||',
33-
'echo',
34-
"''",
35-
])
36-
.stdout.toString()
32+
]).stdout || '')
33+
.toString()
3734
.trimRight()
3835
}
3936
if (remoteAddr) {

test/providers/provider_gitlabci.test.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ describe('GitLabCI Params', () => {
4747
service: 'gitlab',
4848
slug: '',
4949
}
50+
const spawnSync = td.replace(childProcess, 'spawnSync')
51+
td.when(
52+
spawnSync('git', [
53+
'config',
54+
'--get',
55+
'remote.origin.url',
56+
]),
57+
).thenReturn({ stdout: '' })
5058
const params = providerGitLabci.getServiceParams(inputs)
5159
expect(params).toMatchObject(expected)
5260
})
@@ -132,9 +140,6 @@ describe('GitLabCI Params', () => {
132140
'config',
133141
'--get',
134142
'remote.origin.url',
135-
'||',
136-
'echo',
137-
"''",
138143
]),
139144
).thenReturn({ stdout: 'https://gitlab.com/testOrg/testRepo.git' })
140145

@@ -150,9 +155,6 @@ describe('GitLabCI Params', () => {
150155
'config',
151156
'--get',
152157
'remote.origin.url',
153-
'||',
154-
'echo',
155-
"''",
156158
]),
157159
).thenReturn({ stdout: '[email protected]:/' })
158160

@@ -168,9 +170,6 @@ describe('GitLabCI Params', () => {
168170
'config',
169171
'--get',
170172
'remote.origin.url',
171-
'||',
172-
'echo',
173-
"''",
174173
]),
175174
).thenReturn({ stdout: '' })
176175

test/providers/provider_jenkinsci.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ describe('Jenkins CI Params', () => {
7777
service: 'jenkins',
7878
slug: '',
7979
}
80+
const spawnSync = td.replace(childProcess, 'spawnSync')
81+
td.when(
82+
spawnSync('git', [
83+
'config',
84+
'--get',
85+
'remote.origin.url',
86+
]),
87+
).thenReturn({ stdout: '' })
8088
const params = providerJenkinsci.getServiceParams(inputs)
8189
expect(params).toMatchObject(expected)
8290
})

0 commit comments

Comments
 (0)