Skip to content

Commit c8c1e89

Browse files
committed
Rename for clarity
1 parent 083d8dd commit c8c1e89

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Diff for: 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
@@ -597,7 +597,7 @@ func main() {
597597
git := &repoSync{
598598
cmd: *flGitCmd,
599599
root: absRoot,
600-
repo: *flRepo,
600+
remoteRepo: *flRepo,
601601
ref: *flRef,
602602
depth: *flDepth,
603603
submodules: submodulesMode(*flSubmodules),
@@ -1104,12 +1104,12 @@ func (git *repoSync) initRepo(ctx context.Context) error {
11041104
return err
11051105
}
11061106
// It doesn't exist - make it.
1107-
if _, _, err := git.Run(ctx, git.root, "remote", "add", "origin", git.repo); err != nil {
1107+
if _, _, err := git.Run(ctx, git.root, "remote", "add", "origin", git.remoteRepo); err != nil {
11081108
return err
11091109
}
1110-
} else if strings.TrimSpace(stdout) != git.repo {
1110+
} else if strings.TrimSpace(stdout) != git.remoteRepo {
11111111
// It exists, but is wrong.
1112-
if _, _, err := git.Run(ctx, git.root, "remote", "set-url", "origin", git.repo); err != nil {
1112+
if _, _, err := git.Run(ctx, git.root, "remote", "set-url", "origin", git.remoteRepo); err != nil {
11131113
return err
11141114
}
11151115
}
@@ -1535,7 +1535,7 @@ func (git *repoSync) currentWorktree() (worktree, error) {
15351535
// and tries to clean up any detritus. This function returns whether the
15361536
// current hash has changed and what the new hash is.
15371537
func (git *repoSync) SyncRepo(ctx context.Context, refreshCreds func(context.Context) error) (bool, string, error) {
1538-
git.log.V(3).Info("syncing", "repo", git.repo)
1538+
git.log.V(3).Info("syncing", "repo", git.remoteRepo)
15391539

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

16611661
// fetch retrieves the specified ref from the upstream repo.
16621662
func (git *repoSync) fetch(ctx context.Context, ref string) error {
1663-
git.log.V(2).Info("fetching", "ref", ref, "repo", git.repo)
1663+
git.log.V(2).Info("fetching", "ref", ref, "repo", git.remoteRepo)
16641664

16651665
// Fetch the ref and do some cleanup, setting or un-setting the repo's
16661666
// shallow flag as appropriate.
1667-
args := []string{"fetch", git.repo, ref, "--verbose", "--no-progress", "--prune", "--no-auto-gc"}
1667+
args := []string{"fetch", git.remoteRepo, ref, "--verbose", "--no-progress", "--prune", "--no-auto-gc"}
16681668
if git.depth > 0 {
16691669
args = append(args, "--depth", strconv.Itoa(git.depth))
16701670
} else {
@@ -1822,7 +1822,7 @@ func (git *repoSync) CallAskPassURL(ctx context.Context) error {
18221822
}
18231823
}
18241824

1825-
if err := git.StoreCredentials(ctx, git.repo, username, password); err != nil {
1825+
if err := git.StoreCredentials(ctx, git.remoteRepo, username, password); err != nil {
18261826
return err
18271827
}
18281828

0 commit comments

Comments
 (0)