Skip to content

Commit 369f8e0

Browse files
committed
Rename for clarity
1 parent d5c61f7 commit 369f8e0

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

main.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const defaultDirMode = os.FileMode(0775) // subject to umask
109109
type repoSync struct {
110110
cmd string // the git command to run
111111
root absPath // absolute path to the root directory
112-
repo string // remote repo to sync
112+
remoteRepo string // remote repo to sync
113113
ref string // the ref to sync
114114
depth int // for shallow sync
115115
submodules submodulesMode // how to handle submodules
@@ -617,7 +617,7 @@ func main() {
617617
git := &repoSync{
618618
cmd: *flGitCmd,
619619
root: absRoot,
620-
repo: *flRepo,
620+
remoteRepo: *flRepo,
621621
ref: *flRef,
622622
depth: *flDepth,
623623
submodules: submodulesMode(*flSubmodules),
@@ -1124,12 +1124,12 @@ func (git *repoSync) initRepo(ctx context.Context) error {
11241124
return err
11251125
}
11261126
// It doesn't exist - make it.
1127-
if _, _, err := git.Run(ctx, git.root, "remote", "add", "origin", git.repo); err != nil {
1127+
if _, _, err := git.Run(ctx, git.root, "remote", "add", "origin", git.remoteRepo); err != nil {
11281128
return err
11291129
}
1130-
} else if strings.TrimSpace(stdout) != git.repo {
1130+
} else if strings.TrimSpace(stdout) != git.remoteRepo {
11311131
// It exists, but is wrong.
1132-
if _, _, err := git.Run(ctx, git.root, "remote", "set-url", "origin", git.repo); err != nil {
1132+
if _, _, err := git.Run(ctx, git.root, "remote", "set-url", "origin", git.remoteRepo); err != nil {
11331133
return err
11341134
}
11351135
}
@@ -1555,7 +1555,7 @@ func (git *repoSync) currentWorktree() (worktree, error) {
15551555
// and tries to clean up any detritus. This function returns whether the
15561556
// current hash has changed and what the new hash is.
15571557
func (git *repoSync) SyncRepo(ctx context.Context, refreshCreds func(context.Context) error) (bool, string, error) {
1558-
git.log.V(3).Info("syncing", "repo", redactURL(git.repo))
1558+
git.log.V(3).Info("syncing", "repo", redactURL(git.remoteRepo))
15591559

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

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

16851685
// Fetch the ref and do some cleanup, setting or un-setting the repo's
16861686
// shallow flag as appropriate.
1687-
args := []string{"fetch", git.repo, ref, "--verbose", "--no-progress", "--prune", "--no-auto-gc"}
1687+
args := []string{"fetch", git.remoteRepo, ref, "--verbose", "--no-progress", "--prune", "--no-auto-gc"}
16881688
if git.depth > 0 {
16891689
args = append(args, "--depth", strconv.Itoa(git.depth))
16901690
} else {
@@ -1842,7 +1842,7 @@ func (git *repoSync) CallAskPassURL(ctx context.Context) error {
18421842
}
18431843
}
18441844

1845-
if err := git.StoreCredentials(ctx, git.repo, username, password); err != nil {
1845+
if err := git.StoreCredentials(ctx, git.remoteRepo, username, password); err != nil {
18461846
return err
18471847
}
18481848

0 commit comments

Comments
 (0)