Skip to content

Commit d78a75d

Browse files
committed
Remove Repository.LocalCopyPath()
1 parent cb4b50a commit d78a75d

File tree

2 files changed

+0
-35
lines changed

2 files changed

+0
-35
lines changed

models/repo.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -730,11 +730,6 @@ func (repo *Repository) DescriptionHTML() template.HTML {
730730
return template.HTML(markup.Sanitize(string(desc)))
731731
}
732732

733-
// LocalCopyPath returns the local repository copy path for the given repo.
734-
func (repo *Repository) LocalCopyPath() string {
735-
return path.Join(LocalCopyPath(), com.ToStr(repo.ID))
736-
}
737-
738733
// PatchPath returns corresponding patch file path of repository by given issue ID.
739734
func (repo *Repository) PatchPath(index int64) (string, error) {
740735
return repo.patchPath(x, index)
@@ -1516,7 +1511,6 @@ func TransferOwnership(doer *User, newOwnerName string, repo *Repository) error
15161511
if err = os.Rename(RepoPath(owner.Name, repo.Name), RepoPath(newOwner.Name, repo.Name)); err != nil {
15171512
return fmt.Errorf("rename repository directory: %v", err)
15181513
}
1519-
removeAllWithNotice(sess, "Delete repository local copy", repo.LocalCopyPath())
15201514

15211515
// Rename remote wiki repository to new path and delete local copy.
15221516
wikiPath := UncycloPath(owner.Name, repo.Name)
@@ -1566,14 +1560,6 @@ func ChangeRepositoryName(u *User, oldRepoName, newRepoName string) (err error)
15661560
return fmt.Errorf("rename repository directory: %v", err)
15671561
}
15681562

1569-
localPath := repo.LocalCopyPath()
1570-
if com.IsExist(localPath) {
1571-
_, err := git.NewCommand("remote", "set-url", "origin", newRepoPath).RunInDir(localPath)
1572-
if err != nil {
1573-
return fmt.Errorf("git remote set-url origin %s: %v", newRepoPath, err)
1574-
}
1575-
}
1576-
15771563
wikiPath := repo.UncycloPath()
15781564
if com.IsExist(wikiPath) {
15791565
if err = os.Rename(wikiPath, UncycloPath(u.Name, newRepoName)); err != nil {

models/repo_test.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
package models
66

77
import (
8-
"path"
98
"testing"
109

1110
"code.gitea.io/gitea/modules/markup"
12-
"code.gitea.io/gitea/modules/setting"
1311

1412
"github.com/Unknwon/com"
1513
"github.com/stretchr/testify/assert"
@@ -138,25 +136,6 @@ func TestRepoAPIURL(t *testing.T) {
138136
assert.Equal(t, "https://try.gitea.io/api/v1/repos/user12/repo10", repo.APIURL())
139137
}
140138

141-
func TestRepoLocalCopyPath(t *testing.T) {
142-
assert.NoError(t, PrepareTestDatabase())
143-
144-
repo, err := GetRepositoryByID(10)
145-
assert.NoError(t, err)
146-
assert.NotNil(t, repo)
147-
148-
// test default
149-
repoID := com.ToStr(repo.ID)
150-
expected := path.Join(setting.AppDataPath, setting.Repository.Local.LocalCopyPath, repoID)
151-
assert.Equal(t, expected, repo.LocalCopyPath())
152-
153-
// test absolute setting
154-
tempPath := "/tmp/gitea/local-copy-path"
155-
expected = path.Join(tempPath, repoID)
156-
setting.Repository.Local.LocalCopyPath = tempPath
157-
assert.Equal(t, expected, repo.LocalCopyPath())
158-
}
159-
160139
func TestTransferOwnership(t *testing.T) {
161140
assert.NoError(t, PrepareTestDatabase())
162141

0 commit comments

Comments
 (0)