Skip to content

Commit fafd7b7

Browse files
committed
Fix recycle dependency
1 parent b362ffa commit fafd7b7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

modules/git/repo.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,9 @@ func (repo *Repository) CreateBundle(ctx context.Context, commit string, out io.
284284
if err != nil {
285285
return err
286286
}
287-
defer util.RemoveAll(tmp)
287+
defer func() {
288+
_ = util.RemoveAll(tmp)
289+
}()
288290

289291
env := append(os.Environ(), "GIT_OBJECT_DIRECTORY="+filepath.Join(repo.Path, "objects"))
290292
_, _, err = NewCommand(ctx, "init", "--bare").RunStdString(&RunOpts{Dir: tmp, Env: env})

modules/util/legacy_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@ import (
1111
"testing"
1212
"time"
1313

14-
"code.gitea.io/gitea/modules/setting"
15-
1614
"github.com/stretchr/testify/assert"
1715
)
1816

1917
func TestCopyFile(t *testing.T) {
2018
testContent := []byte("hello")
2119

22-
tmpDir := setting.TempDir()
20+
tmpDir := os.TempDir()
2321
now := time.Now()
2422
srcFile := fmt.Sprintf("%s/copy-test-%d-src.txt", tmpDir, now.UnixMicro())
2523
dstFile := fmt.Sprintf("%s/copy-test-%d-dst.txt", tmpDir, now.UnixMicro())

0 commit comments

Comments
 (0)