@@ -143,7 +143,6 @@ func serveDevfile(c *gin.Context) {
143
143
func serveDevfileStarterProject (c * gin.Context ) {
144
144
devfileName := c .Param ("devfileName" )
145
145
starterProjectName := c .Param ("starterProjectName" )
146
- << << << < HEAD
147
146
devfileBytes , devfileIndexSchema := fetchDevfile (c , devfileName )
148
147
149
148
if len (devfileBytes ) == 0 {
@@ -187,15 +186,6 @@ func serveDevfileStarterProject(c *gin.Context) {
187
186
c .JSON (http .StatusNotFound , gin.H {
188
187
"status" : fmt .Sprintf ("the starter project named %s does not exist in the devfile of %s" , starterProjectName , devfileName ),
189
188
})
190
- == == == =
191
- devfileBytes := fetchDevfile (c , devfileName )
192
-
193
- if len (devfileBytes ) == 0 {
194
- // fetchDevfile was unsuccessful (error or not found)
195
- return
196
- } else {
197
- // TODO: Add fetch start project and set response source.
198
- >> >> >> > 2 bb8eb9 ... Implementation 2 for fetchDevfile chosen and added . See Issue #720 discussion at : https ://github.com/devfile/api/issues/720
199
189
}
200
190
}
201
191
@@ -322,11 +312,7 @@ func buildIndexAPIResponse(c *gin.Context) {
322
312
}
323
313
324
314
// fetchDevfile retrieves a specified devfile stored under /registry/**/<devfileName>
325
- << << << < HEAD
326
315
func fetchDevfile (c * gin.Context , devfileName string ) ([]byte , indexSchema.Schema ) {
327
- == == == =
328
- func fetchDevfile (c * gin .Context , devfileName string ) []byte {
329
- >> >> >> > 2 bb8eb9 ... Implementation 2 for fetchDevfile chosen and added. See Issue #720 discussion at : https ://github.com/devfile/api/issues/720
330
316
var index []indexSchema.Schema
331
317
bytes , err := ioutil .ReadFile (indexPath )
332
318
if err != nil {
@@ -335,11 +321,7 @@ func fetchDevfile(c *gin.Context, devfileName string) []byte {
335
321
"error" : err .Error (),
336
322
"status" : fmt .Sprintf ("failed to pull the devfile of %s" , devfileName ),
337
323
})
338
- << << << < HEAD
339
324
return make ([]byte , 0 ), indexSchema.Schema {}
340
- == == == =
341
- return make ([]byte , 0 )
342
- >> >> >> > 2 bb8eb9 ... Implementation 2 for fetchDevfile chosen and added . See Issue #720 discussion at : https ://github.com/devfile/api/issues/720
343
325
}
344
326
err = json .Unmarshal (bytes , & index )
345
327
if err != nil {
@@ -348,11 +330,7 @@ func fetchDevfile(c *gin.Context, devfileName string) []byte {
348
330
"error" : err .Error (),
349
331
"status" : fmt .Sprintf ("failed to pull the devfile of %s" , devfileName ),
350
332
})
351
- << << << < HEAD
352
333
return make ([]byte , 0 ), indexSchema.Schema {}
353
- == == == =
354
- return make ([]byte , 0 )
355
- >> >> >> > 2 bb8eb9 ... Implementation 2 for fetchDevfile chosen and added . See Issue #720 discussion at : https ://github.com/devfile/api/issues/720
356
334
}
357
335
358
336
// Reuse 'bytes' for devfile bytes, assign empty
@@ -375,29 +353,18 @@ func fetchDevfile(c *gin.Context, devfileName string) []byte {
375
353
"error" : err .Error (),
376
354
"status" : fmt .Sprintf ("failed to pull the devfile of %s" , devfileName ),
377
355
})
378
- << << << < HEAD
379
356
return make ([]byte , 0 ), devfileIndex
380
357
}
381
358
382
359
return bytes , devfileIndex
383
- == == == =
384
- return make ([]byte , 0 )
385
- }
386
-
387
- return bytes
388
- >> >> >> > 2 bb8eb9 ... Implementation 2 for fetchDevfile chosen and added . See Issue #720 discussion at : https ://github.com/devfile/api/issues/720
389
360
}
390
361
}
391
362
392
363
c .JSON (http .StatusNotFound , gin.H {
393
364
"status" : fmt .Sprintf ("the devfile of %s didn't exist" , devfileName ),
394
365
})
395
366
396
- << << << < HEAD
397
367
return bytes , indexSchema.Schema {}
398
- == == == =
399
- return bytes
400
- >> >> >> > 2 bb8eb9 ... Implementation 2 for fetchDevfile chosen and added . See Issue #720 discussion at : https ://github.com/devfile/api/issues/720
401
368
}
402
369
403
370
/** source from serveDevfile **/
0 commit comments