Backport #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
This commit is contained in:
parent
43fc99a7ed
commit
3497efac4a
72 changed files with 390 additions and 106 deletions
|
@ -17,6 +17,7 @@ func TestRepository_GetBlob_Found(t *testing.T) {
|
|||
repoPath := filepath.Join(testReposDir, "repo1_bare")
|
||||
r, err := OpenRepository(repoPath)
|
||||
assert.NoError(t, err)
|
||||
defer r.Close()
|
||||
|
||||
testCases := []struct {
|
||||
OID string
|
||||
|
@ -44,6 +45,7 @@ func TestRepository_GetBlob_NotExist(t *testing.T) {
|
|||
repoPath := filepath.Join(testReposDir, "repo1_bare")
|
||||
r, err := OpenRepository(repoPath)
|
||||
assert.NoError(t, err)
|
||||
defer r.Close()
|
||||
|
||||
testCase := "0000000000000000000000000000000000000000"
|
||||
testError := ErrNotExist{testCase, ""}
|
||||
|
@ -57,6 +59,7 @@ func TestRepository_GetBlob_NoId(t *testing.T) {
|
|||
repoPath := filepath.Join(testReposDir, "repo1_bare")
|
||||
r, err := OpenRepository(repoPath)
|
||||
assert.NoError(t, err)
|
||||
defer r.Close()
|
||||
|
||||
testCase := ""
|
||||
testError := fmt.Errorf("Length must be 40: %s", testCase)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue