@@ -105,9 +105,9 @@ func executeBatchSpecInWorkspaces(ctx context.Context, ui *ui.JSONLines, opts ex
105105 return err
106106 }
107107
108- // Since we already know which workspaces we want to execute the steps in,
109- // we can convert them to RepoWorkspaces and build tasks only for those .
110- repoWorkspaces := convertWorkspaces (input .Workspaces )
108+ // Since we already know which workspace we want to execute the steps in,
109+ // we can convert it to a RepoWorkspace and build a task only for that one .
110+ repoWorkspace := convertWorkspace (input .Workspace )
111111
112112 // Parse the raw batch spec contained in the input
113113 ui .ParsingBatchSpec ()
@@ -162,7 +162,7 @@ func executeBatchSpecInWorkspaces(ctx context.Context, ui *ui.JSONLines, opts ex
162162 // `src batch exec` uses server-side caching for changeset specs, so we
163163 // only need to call `CheckStepResultsCache` to make sure that per-step cache entries
164164 // are loaded and set on the tasks.
165- tasks := svc .BuildTasks (ctx , batchSpec , repoWorkspaces )
165+ tasks := svc .BuildTasks (ctx , batchSpec , []service. RepoWorkspace { repoWorkspace } )
166166 if err := coord .CheckStepResultsCache (ctx , tasks ); err != nil {
167167 return err
168168 }
@@ -218,33 +218,26 @@ func loadWorkspaceExecutionInput(file string) (batcheslib.WorkspacesExecutionInp
218218 return input , nil
219219}
220220
221- func convertWorkspaces (ws []* batcheslib.Workspace ) []service.RepoWorkspace {
222- workspaces := make ([]service.RepoWorkspace , 0 , len (ws ))
223-
224- for _ , w := range ws {
225- fileMatches := make (map [string ]bool )
226- for _ , path := range w .SearchResultPaths {
227- fileMatches [path ] = true
228- }
229-
230- workspaces = append (workspaces , service.RepoWorkspace {
231- Repo : & graphql.Repository {
232- ID : w .Repository .ID ,
233- Name : w .Repository .Name ,
234- Branch : graphql.Branch {
235- Name : w .Branch .Name ,
236- Target : graphql.Target {
237- OID : w .Branch .Target .OID ,
238- },
221+ func convertWorkspace (w batcheslib.Workspace ) service.RepoWorkspace {
222+ fileMatches := make (map [string ]bool )
223+ for _ , path := range w .SearchResultPaths {
224+ fileMatches [path ] = true
225+ }
226+ return service.RepoWorkspace {
227+ Repo : & graphql.Repository {
228+ ID : w .Repository .ID ,
229+ Name : w .Repository .Name ,
230+ Branch : graphql.Branch {
231+ Name : w .Branch .Name ,
232+ Target : graphql.Target {
233+ OID : w .Branch .Target .OID ,
239234 },
240- Commit : graphql.Target {OID : w .Branch .Target .OID },
241- FileMatches : fileMatches ,
242235 },
243- Path : w .Path ,
244- Steps : w .Steps ,
245- OnlyFetchWorkspace : w .OnlyFetchWorkspace ,
246- })
236+ Commit : graphql.Target {OID : w .Branch .Target .OID },
237+ FileMatches : fileMatches ,
238+ },
239+ Path : w .Path ,
240+ Steps : w .Steps ,
241+ OnlyFetchWorkspace : w .OnlyFetchWorkspace ,
247242 }
248-
249- return workspaces
250243}
0 commit comments