Skip to content

Commit 058edb9

Browse files
committed
some improvements
1 parent 13a4c9b commit 058edb9

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

modules/repository/temp.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,8 @@ func CreateTemporaryPath(prefix string) (string, context.CancelFunc, error) {
3636
return "", func() {}, fmt.Errorf("failed to create dir %s-*.git: %w", prefix, err)
3737
}
3838
return basePath, func() {
39-
if err := removeTemporaryPath(basePath); err != nil {
39+
if err := util.RemoveAll(basePath); err != nil {
4040
log.Error("Unable to remove temporary directory: %s (%v)", basePath, err)
4141
}
4242
}, nil
4343
}
44-
45-
// removeTemporaryPath removes the temporary path
46-
func removeTemporaryPath(basePath string) error {
47-
if _, err := os.Stat(basePath); !os.IsNotExist(err) {
48-
return util.RemoveAll(basePath)
49-
}
50-
return nil
51-
}

services/pull/temp_repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func createTemporaryRepoForPR(ctx context.Context, pr *issues_model.PullRequest)
7979
log.Error("CreateTemporaryPath[%-v]: %v", pr, err)
8080
return nil, nil, err
8181
}
82-
defer cleanup()
82+
cancel = cleanup
8383

8484
prCtx = &prContext{
8585
Context: ctx,

0 commit comments

Comments
 (0)