Skip to content

Commit df5d00e

Browse files
committed
Rename functions name
1 parent 74dfb17 commit df5d00e

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

modules/git/remote.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
giturl "code.gitea.io/gitea/modules/git/url"
1111
)
1212

13-
// GetRemoteURL returns remote url of git repository in the repoPath with special remote name
14-
func GetRemoteURL(ctx context.Context, repoPath, remoteName string) (string, error) {
13+
// GetRemoteAddress returns remote url of git repository in the repoPath with special remote name
14+
func GetRemoteAddress(ctx context.Context, repoPath, remoteName string) (string, error) {
1515
err := LoadGitVersion()
1616
if err != nil {
1717
return "", err
@@ -34,11 +34,11 @@ func GetRemoteURL(ctx context.Context, repoPath, remoteName string) (string, err
3434
return result, nil
3535
}
3636

37-
// GetRemoteAddress returns the url of a specific remote of the repository.
38-
func GetRemoteAddress(ctx context.Context, repoPath, remoteName string) (*giturl.GitURL, error) {
39-
result, err := GetRemoteURL(ctx, repoPath, remoteName)
37+
// GetRemoteURL returns the url of a specific remote of the repository.
38+
func GetRemoteURL(ctx context.Context, repoPath, remoteName string) (*giturl.GitURL, error) {
39+
addr, err := GetRemoteAddress(ctx, repoPath, remoteName)
4040
if err != nil {
4141
return nil, err
4242
}
43-
return giturl.Parse(result)
43+
return giturl.Parse(addr)
4444
}

modules/git/url/url.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func Parse(remote string) (*GitURL, error) {
6161
lastIndex = i + 1
6262
case ':':
6363
if !squareBrackets {
64-
url.Host = strings.Replace(remote[lastIndex:i], "%25", "%", -1)
64+
url.Host = strings.ReplaceAll(remote[lastIndex:i], "%25", "%")
6565
if len(remote) <= i+1 {
6666
return nil, ErrWrongURLFormat{URL: remote}
6767
}

modules/templates/helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ func mirrorRemoteAddress(ctx context.Context, m *repo_model.Repository, remoteNa
920920
remoteURL := m.OriginalURL
921921
if remoteURL == "" {
922922
var err error
923-
remoteURL, err = git.GetRemoteURL(ctx, m.RepoPath(), remoteName)
923+
remoteURL, err = git.GetRemoteAddress(ctx, m.RepoPath(), remoteName)
924924
if err != nil {
925925
log.Error("GetRemoteURL %v", err)
926926
return a

routers/web/repo/setting.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func SettingsPost(ctx *context.Context) {
202202
}
203203
}
204204

205-
u, err := git.GetRemoteAddress(ctx, ctx.Repo.Repository.RepoPath(), ctx.Repo.Mirror.GetRemoteName())
205+
u, err := git.GetRemoteURL(ctx, ctx.Repo.Repository.RepoPath(), ctx.Repo.Mirror.GetRemoteName())
206206
if err != nil {
207207
ctx.Data["Err_MirrorAddress"] = true
208208
handleSettingRemoteAddrError(ctx, err, form)

services/mirror/mirror_pull.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func runSync(ctx context.Context, m *repo_model.Mirror) ([]*mirrorSyncResult, bo
211211
}
212212
gitArgs = append(gitArgs, m.GetRemoteName())
213213

214-
remoteAddr, remoteErr := git.GetRemoteAddress(ctx, repoPath, m.GetRemoteName())
214+
remoteURL, remoteErr := git.GetRemoteURL(ctx, repoPath, m.GetRemoteName())
215215
if remoteErr != nil {
216216
log.Error("SyncMirrors [repo: %-v]: GetRemoteAddress Error %v", m.Repo, remoteErr)
217217
return nil, false
@@ -293,7 +293,7 @@ func runSync(ctx context.Context, m *repo_model.Mirror) ([]*mirrorSyncResult, bo
293293

294294
if m.LFS && setting.LFS.StartServer {
295295
log.Trace("SyncMirrors [repo: %-v]: syncing LFS objects...", m.Repo)
296-
endpoint := lfs.DetermineEndpoint(remoteAddr.String(), m.LFSEndpoint)
296+
endpoint := lfs.DetermineEndpoint(remoteURL.String(), m.LFSEndpoint)
297297
lfsClient := lfs.NewClient(endpoint, nil)
298298
if err = repo_module.StoreMissingLfsObjectsInRepository(ctx, m.Repo, gitRepo, lfsClient); err != nil {
299299
log.Error("SyncMirrors [repo: %-v]: failed to synchronize LFS objects for repository: %v", m.Repo, err)

services/mirror/mirror_push.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func runPushSync(ctx context.Context, m *repo_model.PushMirror) error {
131131
timeout := time.Duration(setting.Git.Timeout.Mirror) * time.Second
132132

133133
performPush := func(path string) error {
134-
remoteAddr, err := git.GetRemoteAddress(ctx, path, m.RemoteName)
134+
remoteURL, err := git.GetRemoteURL(ctx, path, m.RemoteName)
135135
if err != nil {
136136
log.Error("GetRemoteAddress(%s) Error %v", path, err)
137137
return errors.New("Unexpected error")
@@ -147,7 +147,7 @@ func runPushSync(ctx context.Context, m *repo_model.PushMirror) error {
147147
}
148148
defer gitRepo.Close()
149149

150-
endpoint := lfs.DetermineEndpoint(remoteAddr.String(), "")
150+
endpoint := lfs.DetermineEndpoint(remoteURL.String(), "")
151151
lfsClient := lfs.NewClient(endpoint, nil)
152152
if err := pushAllLFSObjects(ctx, gitRepo, lfsClient); err != nil {
153153
return util.SanitizeErrorCredentialURLs(err)

0 commit comments

Comments
 (0)