From 182e39d2f41001b43d3c26000ee52675264f52f2 Mon Sep 17 00:00:00 2001 From: Earl Warren <109468362+earl-warren@users.noreply.github.com> Date: Tue, 19 Sep 2023 16:45:44 +0200 Subject: [PATCH] services/wiki: Close() after error handling (#27129) Refs: https://codeberg.org/forgejo/forgejo/pulls/1385 Signed-off-by: Lars Lehtonen (cherry picked from commit 589e7d346f51de4a0e2c461b220c8cad34133b2f) Co-authored-by: Lars Lehtonen --- services/wiki/wiki_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/wiki/wiki_test.go b/services/wiki/wiki_test.go index 7984bf899d2f3..327e4e96786d0 100644 --- a/services/wiki/wiki_test.go +++ b/services/wiki/wiki_test.go @@ -249,8 +249,8 @@ func TestPrepareWikiFileName(t *testing.T) { unittest.PrepareTestEnv(t) repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}) gitRepo, err := git.OpenRepository(git.DefaultContext, repo.WikiPath()) - defer gitRepo.Close() assert.NoError(t, err) + defer gitRepo.Close() tests := []struct { name string @@ -301,8 +301,8 @@ func TestPrepareWikiFileName_FirstPage(t *testing.T) { assert.NoError(t, err) gitRepo, err := git.OpenRepository(git.DefaultContext, tmpDir) - defer gitRepo.Close() assert.NoError(t, err) + defer gitRepo.Close() existence, newWikiPath, err := prepareGitPath(gitRepo, "Home") assert.False(t, existence)