Skip to content

Commit d1efe20

Browse files
ethantkoenigappleboy
authored andcommitted
Fix integration tests (#3141)
1 parent 41d6afe commit d1efe20

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

integrations/integration_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ func initIntegrationTest() {
136136
func prepareTestEnv(t testing.TB) {
137137
assert.NoError(t, models.LoadFixtures())
138138
assert.NoError(t, os.RemoveAll(setting.RepoRootPath))
139+
assert.NoError(t, os.RemoveAll(models.LocalCopyPath()))
139140

140141
assert.NoError(t, com.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"),
141142
setting.RepoRootPath))

models/repo.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -757,12 +757,17 @@ func (repo *Repository) DescriptionHTML() template.HTML {
757757
return template.HTML(descPattern.ReplaceAllStringFunc(markup.Sanitize(repo.Description), sanitize))
758758
}
759759

760-
// LocalCopyPath returns the local repository copy path
761-
func (repo *Repository) LocalCopyPath() string {
760+
// LocalCopyPath returns the local repository copy path.
761+
func LocalCopyPath() string {
762762
if filepath.IsAbs(setting.Repository.Local.LocalCopyPath) {
763-
return path.Join(setting.Repository.Local.LocalCopyPath, com.ToStr(repo.ID))
763+
return setting.Repository.Local.LocalCopyPath
764764
}
765-
return path.Join(setting.AppDataPath, setting.Repository.Local.LocalCopyPath, com.ToStr(repo.ID))
765+
return path.Join(setting.AppDataPath, setting.Repository.Local.LocalCopyPath)
766+
}
767+
768+
// LocalCopyPath returns the local repository copy path for the given repo.
769+
func (repo *Repository) LocalCopyPath() string {
770+
return path.Join(LocalCopyPath(), com.ToStr(repo.ID))
766771
}
767772

768773
// UpdateLocalCopyBranch pulls latest changes of given branch from repoPath to localPath.

0 commit comments

Comments
 (0)