@@ -140,19 +140,26 @@ func (ws *GitInitializer) Run(ctx context.Context, mappings []archive.IDMapping)
140
140
res , _ = cmd .CombinedOutput ()
141
141
log .Infof ("[0] ls -al %s: %v" , ws .Location + "/.git/" , string (res ))
142
142
}
143
+
143
144
if err := ws .realizeCloneTarget (ctx ); err != nil {
144
145
return src , xerrors .Errorf ("git initializer clone: %w" , err )
145
146
}
147
+
148
+ cmd := exec .Command ("ls" , "-al" , ws .Location + "/.git/" )
149
+ res , _ := cmd .CombinedOutput ()
150
+ log .Infof ("[1] ls -al %s: %v" , ws .Location + "/.git/" , string (res ))
151
+
146
152
if err := ws .UpdateRemote (ctx ); err != nil {
147
153
return src , xerrors .Errorf ("git initializer updateRemote: %w" , err )
148
154
}
155
+
149
156
if err := ws .UpdateSubmodules (ctx ); err != nil {
150
157
log .WithError (err ).Warn ("error while updating submodules - continuing" )
151
158
}
152
159
153
- cmd : = exec .Command ("ls" , "-al" , ws .Location + "/.git/" )
154
- res , _ : = cmd .CombinedOutput ()
155
- log .Infof ("[1 ] ls -al %s: %v" , ws .Location + "/.git/" , string (res ))
160
+ cmd = exec .Command ("ls" , "-al" , ws .Location + "/.git/" )
161
+ res , _ = cmd .CombinedOutput ()
162
+ log .Infof ("[2 ] ls -al %s: %v" , ws .Location + "/.git/" , string (res ))
156
163
157
164
log .WithField ("stage" , "init" ).WithField ("location" , ws .Location ).Debug ("Git operations complete" )
158
165
return
@@ -181,11 +188,21 @@ func (ws *GitInitializer) realizeCloneTarget(ctx context.Context) (err error) {
181
188
log .WithError (err ).WithField ("remoteURI" , ws .RemoteURI ).WithField ("branch" , ws .CloneTarget ).Error ("Remote branch doesn't exist." )
182
189
return err
183
190
}
191
+
192
+ cmd := exec .Command ("ls" , "-al" , ws .Location + "/.git/" )
193
+ res , _ := cmd .CombinedOutput ()
194
+ log .Infof ("[realizeCloneTarget][0] ls -al %s: %v" , ws .Location + "/.git/" , string (res ))
195
+
184
196
// create local branch based on specific remote branch
185
197
if err := ws .Git (ctx , "checkout" , "-B" , ws .CloneTarget , "origin/" + ws .CloneTarget ); err != nil {
186
198
log .WithError (err ).WithField ("remoteURI" , ws .RemoteURI ).WithField ("branch" , ws .CloneTarget ).Error ("Cannot checkout remote branch." )
187
199
return err
188
200
}
201
+
202
+ cmd = exec .Command ("ls" , "-al" , ws .Location + "/.git/" )
203
+ res , _ = cmd .CombinedOutput ()
204
+ log .Infof ("[realizeCloneTarget][1] ls -al %s: %v" , ws .Location + "/.git/" , string (res ))
205
+
189
206
case LocalBranch :
190
207
// checkout local branch based on remote HEAD
191
208
if err := ws .Git (ctx , "checkout" , "-B" , ws .CloneTarget , "origin/HEAD" , "--no-track" ); err != nil {
@@ -219,11 +236,11 @@ func (ws *GitInitializer) realizeCloneTarget(ctx context.Context) (err error) {
219
236
}
220
237
221
238
func checkGitStatus (err error ) error {
222
- if err != nil {
223
- if strings .Contains (err .Error (), "The requested URL returned error: 524" ) {
224
- return fmt .Errorf ("Git clone returned HTTP status 524 (see https://gitlab.com/gitlab-com/gl-infra/reliability/-/issues/8475). Please try restarting your workspace" )
225
- }
239
+ if err == nil {
240
+ return nil
241
+ }
242
+ if strings .Contains (err .Error (), "The requested URL returned error: 524" ) {
243
+ return fmt .Errorf ("Git clone returned HTTP status 524 (see https://gitlab.com/gitlab-com/gl-infra/reliability/-/issues/8475). Please try restarting your workspace" )
226
244
}
227
-
228
245
return err
229
246
}
0 commit comments