From 589e7d346f51de4a0e2c461b220c8cad34133b2f Mon Sep 17 00:00:00 2001 From: Lars Lehtonen Date: Wed, 6 Sep 2023 09:08:28 -0700 Subject: [PATCH] [GITEA] services/wiki: Close() after error handling Refs: https://codeberg.org/forgejo/forgejo/pulls/1385 Signed-off-by: Lars Lehtonen (cherry picked from commit c6a85d760693bcecb0a5df24bfe0ee662c593725) (cherry picked from commit fc065c8294322b2d8bd3dbff524bf3f0669bbaec) (cherry picked from commit de7e33e7a5b6c63b68d829e724639bd80811cce5) --- 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 0621456f3e..6f05dedab6 100644 --- a/services/wiki/wiki_test.go +++ b/services/wiki/wiki_test.go @@ -251,8 +251,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 @@ -303,8 +303,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)