Skip to content

Commit a015cd1

Browse files
authored
Merge pull request #22 from ThreeDotsLabs/specify-directory-with-clone
specify directory for clone - fix
2 parents 0f0e6f7 + 6ac8add commit a015cd1

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

trainings/clone.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ import (
1414
)
1515

1616
func (h *Handlers) Clone(ctx context.Context, executionID string, directory string) error {
17-
pwd, err := os.Getwd()
18-
if err != nil {
19-
return fmt.Errorf("failed to get current working directory: %w", err)
20-
}
21-
2217
resp, err := h.newGrpcClient(ctx).GetSolutionFiles(ctx, &genproto.GetSolutionFilesRequest{
2318
ExecutionId: executionID,
2419
})
@@ -42,7 +37,7 @@ func (h *Handlers) Clone(ctx context.Context, executionID string, directory stri
4237
return err
4338
}
4439

45-
trainingRootFs := afero.NewBasePathFs(afero.NewOsFs(), pwd).(*afero.BasePathFs)
40+
trainingRootFs := afero.NewBasePathFs(afero.NewOsFs(), absoluteDirToClone).(*afero.BasePathFs)
4641

4742
if err := h.config.WriteTrainingConfig(config.TrainingConfig{TrainingName: resp.TrainingName}, trainingRootFs); err != nil {
4843
return errors.Wrap(err, "can't write training config")
@@ -60,7 +55,7 @@ func (h *Handlers) Clone(ctx context.Context, executionID string, directory stri
6055
return err
6156
}
6257

63-
err = addModuleToWorkspace(pwd, resp.Dir)
58+
err = addModuleToWorkspace(absoluteDirToClone, resp.Dir)
6459
if err != nil {
6560
logrus.WithError(err).Warn("Failed to add module to workspace")
6661
}

0 commit comments

Comments
 (0)