@@ -110,8 +110,6 @@ describe('GitHelper', () => {
110
110
await helper . checkout ( workDir , context ( ) ) ;
111
111
112
112
execCalledWith ( mockExec , [
113
- 'rm -rdf \'.work\'' ,
114
- 'git init \'.\'' ,
115
113
'git remote add origin \'https://octocat:[email protected] /hello/world.git\' > /dev/null 2>&1 || :' ,
116
114
'git fetch --no-tags origin \'refs/heads/test-ref:refs/remotes/origin/test-ref\' || :' ,
117
115
'git checkout -qf test-sha' ,
@@ -124,8 +122,6 @@ describe('GitHelper', () => {
124
122
await helper . checkout ( workDir , context ( { ref : 'refs/pull/123/merge' } ) ) ;
125
123
126
124
execCalledWith ( mockExec , [
127
- 'rm -rdf \'.work\'' ,
128
- 'git init \'.\'' ,
129
125
'git remote add origin \'https://octocat:[email protected] /hello/world.git\' > /dev/null 2>&1 || :' ,
130
126
'git fetch --no-tags origin \'refs/pull/123/merge:refs/pull/123/merge\' || :' ,
131
127
'git checkout -qf test-sha' ,
@@ -138,8 +134,6 @@ describe('GitHelper', () => {
138
134
await helper . checkout ( workDir , context ( { ref : 'refs/tags/v1.2.3' } ) ) ;
139
135
140
136
execCalledWith ( mockExec , [
141
- 'rm -rdf \'.work\'' ,
142
- 'git init \'.\'' ,
143
137
'git remote add origin \'https://octocat:[email protected] /hello/world.git\' > /dev/null 2>&1 || :' ,
144
138
'git fetch --no-tags origin \'refs/tags/v1.2.3:refs/tags/v1.2.3\' || :' ,
145
139
'git checkout -qf test-sha' ,
@@ -179,6 +173,17 @@ describe('GitHelper', () => {
179
173
180
174
await helper . addOrigin ( workDir , context ( ) ) ;
181
175
176
+ execCalledWith ( mockExec , [
177
+ 'git remote add origin \'https://octocat:[email protected] /hello/world.git\' > /dev/null 2>&1 || :' ,
178
+ ] ) ;
179
+ } ) ;
180
+
181
+ it ( 'should run git init and git remote add' , async ( ) => {
182
+ const mockExec = spyOnExec ( ) ;
183
+ setExists ( [ false , true ] ) ;
184
+
185
+ await helper . addOrigin ( workDir , context ( ) ) ;
186
+
182
187
execCalledWith ( mockExec , [
183
188
`rm -rdf '${ workDir } '` ,
184
189
'git init \'.\'' ,
@@ -194,8 +199,6 @@ describe('GitHelper', () => {
194
199
await helper . fetchOrigin ( workDir , context ( ) ) ;
195
200
196
201
execCalledWith ( mockExec , [
197
- `rm -rdf '${ workDir } '` ,
198
- 'git init \'.\'' ,
199
202
'git remote add origin \'https://octocat:[email protected] /hello/world.git\' > /dev/null 2>&1 || :' ,
200
203
'git fetch origin || :' ,
201
204
] ) ;
@@ -207,8 +210,6 @@ describe('GitHelper', () => {
207
210
await helper . fetchOrigin ( workDir , context ( ) , [ '--no-tags' ] ) ;
208
211
209
212
execCalledWith ( mockExec , [
210
- `rm -rdf '${ workDir } '` ,
211
- 'git init \'.\'' ,
212
213
'git remote add origin \'https://octocat:[email protected] /hello/world.git\' > /dev/null 2>&1 || :' ,
213
214
'git fetch --no-tags origin || :' ,
214
215
] ) ;
@@ -220,8 +221,6 @@ describe('GitHelper', () => {
220
221
await helper . fetchOrigin ( workDir , context ( ) , undefined , [ '+refs/pull/*/merge:refs/remotes/pull/*/merge' , '+refs/heads/hoge:refs/remotes/origin/hoge' ] ) ;
221
222
222
223
execCalledWith ( mockExec , [
223
- `rm -rdf '${ workDir } '` ,
224
- 'git init \'.\'' ,
225
224
'git remote add origin \'https://octocat:[email protected] /hello/world.git\' > /dev/null 2>&1 || :' ,
226
225
'git fetch origin \'+refs/pull/*/merge:refs/remotes/pull/*/merge\' \'+refs/heads/hoge:refs/remotes/origin/hoge\' || :' ,
227
226
] ) ;
0 commit comments