Skip to content

Commit

Permalink
Fix integration tests (go-gitea#3141)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethantkoenig authored and appleboy committed Dec 11, 2017
1 parent 41d6afe commit d1efe20
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions integrations/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func initIntegrationTest() {
func prepareTestEnv(t testing.TB) {
assert.NoError(t, models.LoadFixtures())
assert.NoError(t, os.RemoveAll(setting.RepoRootPath))
assert.NoError(t, os.RemoveAll(models.LocalCopyPath()))

assert.NoError(t, com.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"),
setting.RepoRootPath))
Expand Down
13 changes: 9 additions & 4 deletions models/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -757,12 +757,17 @@ func (repo *Repository) DescriptionHTML() template.HTML {
return template.HTML(descPattern.ReplaceAllStringFunc(markup.Sanitize(repo.Description), sanitize))
}

// LocalCopyPath returns the local repository copy path
func (repo *Repository) LocalCopyPath() string {
// LocalCopyPath returns the local repository copy path.
func LocalCopyPath() string {
if filepath.IsAbs(setting.Repository.Local.LocalCopyPath) {
return path.Join(setting.Repository.Local.LocalCopyPath, com.ToStr(repo.ID))
return setting.Repository.Local.LocalCopyPath
}
return path.Join(setting.AppDataPath, setting.Repository.Local.LocalCopyPath, com.ToStr(repo.ID))
return path.Join(setting.AppDataPath, setting.Repository.Local.LocalCopyPath)
}

// LocalCopyPath returns the local repository copy path for the given repo.
func (repo *Repository) LocalCopyPath() string {
return path.Join(LocalCopyPath(), com.ToStr(repo.ID))
}

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

0 comments on commit d1efe20

Please sign in to comment.