Skip to content

Commit 04ea5e4

Browse files
committed
Rename for clarity
1 parent 69eb591 commit 04ea5e4

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

main.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const defaultDirMode = os.FileMode(0775) // subject to umask
117117
type repoSync struct {
118118
cmd string // the git command to run
119119
root absPath // absolute path to the root directory
120-
repo string // remote repo to sync
120+
remoteRepo string // remote repo to sync
121121
ref string // the ref to sync
122122
depth int // for shallow sync
123123
submodules submodulesMode // how to handle submodules
@@ -706,7 +706,7 @@ func main() {
706706
git := &repoSync{
707707
cmd: *flGitCmd,
708708
root: absRoot,
709-
repo: *flRepo,
709+
remoteRepo: *flRepo,
710710
ref: *flRef,
711711
depth: *flDepth,
712712
submodules: submodulesMode(*flSubmodules),
@@ -1260,12 +1260,12 @@ func (git *repoSync) initRepo(ctx context.Context) error {
12601260
return err
12611261
}
12621262
// It doesn't exist - make it.
1263-
if _, _, err := git.Run(ctx, git.root, "remote", "add", "origin", git.repo); err != nil {
1263+
if _, _, err := git.Run(ctx, git.root, "remote", "add", "origin", git.remoteRepo); err != nil {
12641264
return err
12651265
}
1266-
} else if strings.TrimSpace(stdout) != git.repo {
1266+
} else if strings.TrimSpace(stdout) != git.remoteRepo {
12671267
// It exists, but is wrong.
1268-
if _, _, err := git.Run(ctx, git.root, "remote", "set-url", "origin", git.repo); err != nil {
1268+
if _, _, err := git.Run(ctx, git.root, "remote", "set-url", "origin", git.remoteRepo); err != nil {
12691269
return err
12701270
}
12711271
}
@@ -1715,7 +1715,7 @@ func (git *repoSync) currentWorktree() (worktree, error) {
17151715
// and tries to clean up any detritus. This function returns whether the
17161716
// current hash has changed and what the new hash is.
17171717
func (git *repoSync) SyncRepo(ctx context.Context, refreshCreds func(context.Context) error) (bool, string, error) {
1718-
git.log.V(3).Info("syncing", "repo", redactURL(git.repo))
1718+
git.log.V(3).Info("syncing", "repo", redactURL(git.remoteRepo))
17191719

17201720
if err := refreshCreds(ctx); err != nil {
17211721
return false, "", fmt.Errorf("credential refresh failed: %w", err)
@@ -1840,11 +1840,11 @@ func (git *repoSync) SyncRepo(ctx context.Context, refreshCreds func(context.Con
18401840

18411841
// fetch retrieves the specified ref from the upstream repo.
18421842
func (git *repoSync) fetch(ctx context.Context, ref string) error {
1843-
git.log.V(2).Info("fetching", "ref", ref, "repo", redactURL(git.repo))
1843+
git.log.V(2).Info("fetching", "ref", ref, "repo", redactURL(git.remoteRepo))
18441844

18451845
// Fetch the ref and do some cleanup, setting or un-setting the repo's
18461846
// shallow flag as appropriate.
1847-
args := []string{"fetch", git.repo, ref, "--verbose", "--no-progress", "--prune", "--no-auto-gc"}
1847+
args := []string{"fetch", git.remoteRepo, ref, "--verbose", "--no-progress", "--prune", "--no-auto-gc"}
18481848
if git.depth > 0 {
18491849
args = append(args, "--depth", strconv.Itoa(git.depth))
18501850
} else {
@@ -2014,7 +2014,7 @@ func (git *repoSync) CallAskPassURL(ctx context.Context) error {
20142014
}
20152015
}
20162016

2017-
if err := git.StoreCredentials(ctx, git.repo, username, password); err != nil {
2017+
if err := git.StoreCredentials(ctx, git.remoteRepo, username, password); err != nil {
20182018
return err
20192019
}
20202020

@@ -2102,7 +2102,7 @@ func (git *repoSync) RefreshGitHubAppToken(ctx context.Context, githubBaseURL, p
21022102
username := "-"
21032103
password := tokenResponse.Token
21042104

2105-
if err := git.StoreCredentials(ctx, git.repo, username, password); err != nil {
2105+
if err := git.StoreCredentials(ctx, git.remoteRepo, username, password); err != nil {
21062106
return err
21072107
}
21082108

0 commit comments

Comments
 (0)