Skip to content

Commit f395cbb

Browse files
committed
Rename Clone functions
1 parent 63f1a29 commit f395cbb

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

modules/gitrepo/clone.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ import (
99
"code.gitea.io/gitea/modules/git"
1010
)
1111

12-
func CloneIn(ctx context.Context, dstRepo Repository, from string, opts git.CloneRepoOptions) error {
13-
return git.Clone(ctx, from, repoPath(dstRepo), opts)
12+
// CloneExternalRepo clones an external repository to the managed repository.
13+
func CloneExternalRepo(ctx context.Context, dstRepo Repository, remoteURL string, opts git.CloneRepoOptions) error {
14+
return git.Clone(ctx, remoteURL, repoPath(dstRepo), opts)
1415
}
1516

16-
func CloneOut(ctx context.Context, fromRepo Repository, to string, opts git.CloneRepoOptions) error {
17+
// CloneRepoToLocal clones a managed repository to a local path.
18+
func CloneRepoToLocal(ctx context.Context, fromRepo Repository, to string, opts git.CloneRepoOptions) error {
1719
return git.Clone(ctx, repoPath(fromRepo), to, opts)
1820
}

services/repository/migrate.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ import (
2828
)
2929

3030
func cloneWiki(ctx context.Context, repo *repo_model.Repository, opts migration.MigrateOptions, migrateTimeout time.Duration) (string, error) {
31-
wikiRemotePath := repo_module.WikiRemoteURL(ctx, opts.CloneAddr)
32-
if wikiRemotePath == "" {
31+
wikiRemoteURL := repo_module.WikiRemoteURL(ctx, opts.CloneAddr)
32+
if wikiRemoteURL == "" {
3333
return "", nil
3434
}
3535

@@ -44,7 +44,7 @@ func cloneWiki(ctx context.Context, repo *repo_model.Repository, opts migration.
4444
log.Error("Failed to remove incomplete wiki dir %q, err: %v", storageRepo.RelativePath(), err)
4545
}
4646
}
47-
if err := gitrepo.CloneIn(ctx, storageRepo, wikiRemotePath, git.CloneRepoOptions{
47+
if err := gitrepo.CloneExternalRepo(ctx, storageRepo, wikiRemoteURL, git.CloneRepoOptions{
4848
Mirror: true,
4949
Quiet: true,
5050
Timeout: migrateTimeout,

services/wiki/wiki.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func updateWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model
120120
cloneOpts.Branch = repo.DefaultWikiBranch
121121
}
122122

123-
if err := gitrepo.CloneOut(ctx, repo.WikiStorageRepo(), basePath, cloneOpts); err != nil {
123+
if err := gitrepo.CloneRepoToLocal(ctx, repo.WikiStorageRepo(), basePath, cloneOpts); err != nil {
124124
log.Error("Failed to clone repository: %s (%v)", repo.FullName(), err)
125125
return fmt.Errorf("failed to clone repository: %s (%w)", repo.FullName(), err)
126126
}
@@ -269,7 +269,7 @@ func DeleteWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model
269269
}
270270
defer cleanup()
271271

272-
if err := gitrepo.CloneOut(ctx, repo.WikiStorageRepo(), basePath, git.CloneRepoOptions{
272+
if err := gitrepo.CloneRepoToLocal(ctx, repo.WikiStorageRepo(), basePath, git.CloneRepoOptions{
273273
Bare: true,
274274
Shared: true,
275275
Branch: repo.DefaultWikiBranch,

0 commit comments

Comments
 (0)