Skip to content

Commit 2c70eb9

Browse files
committed
make the code simpler
1 parent a66e32d commit 2c70eb9

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

modules/gitrepo/main_test.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,16 @@ const (
1818

1919
func TestMain(m *testing.M) {
2020
originalRepoRootPath := setting.RepoRootPath
21-
defer func() {
22-
setting.RepoRootPath = originalRepoRootPath
23-
}()
24-
setting.RepoRootPath, _ = filepath.Abs(testReposDir)
25-
2621
originalHomePath := setting.Git.HomePath
27-
defer func() {
28-
setting.Git.HomePath = originalHomePath
29-
}()
30-
setting.Git.HomePath = filepath.Join(setting.RepoRootPath, ".home")
31-
3222
originalGitPath := setting.Git.Path
3323
defer func() {
24+
setting.RepoRootPath = originalRepoRootPath
25+
setting.Git.HomePath = originalHomePath
3426
setting.Git.Path = originalGitPath
3527
}()
28+
29+
setting.RepoRootPath, _ = filepath.Abs(testReposDir)
30+
setting.Git.HomePath = filepath.Join(setting.RepoRootPath, ".home")
3631
setting.Git.Path = "git"
3732

3833
if err := git.InitSimple(); err != nil {

0 commit comments

Comments
 (0)