Skip to content

Commit e477a49

Browse files
committed
fix: compress complicated temp directory code
1 parent 62d6b43 commit e477a49

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

internal/pkg/create/create.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,15 +378,14 @@ func createAppFromSubdir(ctx context.Context, dirPath string, template Template,
378378
if err != nil {
379379
return slackerror.Wrap(err, "failed to create temporary directory")
380380
}
381-
// Remove so createApp can create it fresh (go-git requires non-existent target)
382-
os.Remove(tmpDir)
383381
defer os.RemoveAll(tmpDir)
384382

385-
if err := createApp(ctx, tmpDir, template, gitBranch, log, fs); err != nil {
383+
cloneDir := filepath.Join(tmpDir, "repo")
384+
if err := createApp(ctx, cloneDir, template, gitBranch, log, fs); err != nil {
386385
return err
387386
}
388387

389-
subdirPath := filepath.Join(tmpDir, subdir)
388+
subdirPath := filepath.Join(cloneDir, subdir)
390389
info, err := os.Stat(subdirPath)
391390
if err != nil {
392391
if os.IsNotExist(err) {

0 commit comments

Comments
 (0)