From 722a7c902dd39bd3d4328345ca969220640774d7 Mon Sep 17 00:00:00 2001 From: zeripath Date: Wed, 13 Nov 2019 07:01:19 +0000 Subject: Add Close() method to gogitRepository (#8901) In investigating #7947 it has become clear that the storage component of go-git repositories needs closing. This PR adds this Close function and adds the Close functions as necessary. In TransferOwnership the ctx.Repo.GitRepo is closed if it is open to help prevent the risk of multiple open files. Fixes #7947 --- modules/git/blob_test.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'modules/git/blob_test.go') diff --git a/modules/git/blob_test.go b/modules/git/blob_test.go index 66c046ecc8..9043de5955 100644 --- a/modules/git/blob_test.go +++ b/modules/git/blob_test.go @@ -37,6 +37,8 @@ THE SOFTWARE. ` repo, err := OpenRepository("../../.git") assert.NoError(t, err) + defer repo.Close() + testBlob, err := repo.GetBlob("a8d4b49dd073a4a38a7e58385eeff7cc52568697") assert.NoError(t, err) @@ -55,6 +57,8 @@ func Benchmark_Blob_Data(b *testing.B) { if err != nil { b.Fatal(err) } + defer repo.Close() + testBlob, err := repo.GetBlob("a8d4b49dd073a4a38a7e58385eeff7cc52568697") if err != nil { b.Fatal(err) -- cgit v1.2.3