Skip to content

Commit b8792bf

Browse files
committed
Rename for clarity
1 parent 83622fc commit b8792bf

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

main.go

Lines changed: 10 additions & 10 deletions
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
filter string // for partial clone
@@ -726,7 +726,7 @@ func main() {
726726
git := &repoSync{
727727
cmd: *flGitCmd,
728728
root: absRoot,
729-
repo: *flRepo,
729+
remoteRepo: *flRepo,
730730
ref: *flRef,
731731
depth: *flDepth,
732732
filter: *flFilter,
@@ -1300,12 +1300,12 @@ func (git *repoSync) initRepo(ctx context.Context) error {
13001300
return err
13011301
}
13021302
// It doesn't exist - make it.
1303-
if _, _, err := git.Run(ctx, git.root, "remote", "add", "origin", git.repo); err != nil {
1303+
if _, _, err := git.Run(ctx, git.root, "remote", "add", "origin", git.remoteRepo); err != nil {
13041304
return err
13051305
}
1306-
} else if strings.TrimSpace(stdout) != git.repo {
1306+
} else if strings.TrimSpace(stdout) != git.remoteRepo {
13071307
// It exists, but is wrong.
1308-
if _, _, err := git.Run(ctx, git.root, "remote", "set-url", "origin", git.repo); err != nil {
1308+
if _, _, err := git.Run(ctx, git.root, "remote", "set-url", "origin", git.remoteRepo); err != nil {
13091309
return err
13101310
}
13111311
}
@@ -1755,7 +1755,7 @@ func (git *repoSync) currentWorktree() (worktree, error) {
17551755
// and tries to clean up any detritus. This function returns whether the
17561756
// current hash has changed and what the new hash is.
17571757
func (git *repoSync) SyncRepo(ctx context.Context, refreshCreds func(context.Context) error) (bool, string, error) {
1758-
git.log.V(3).Info("syncing", "repo", redactURL(git.repo))
1758+
git.log.V(3).Info("syncing", "repo", redactURL(git.remoteRepo))
17591759

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

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

18851885
// Fetch the ref and do some cleanup, setting or un-setting the repo's
18861886
// shallow flag as appropriate.
1887-
args := []string{"fetch", git.repo, ref, "--verbose", "--no-progress", "--prune", "--no-auto-gc"}
1887+
args := []string{"fetch", git.remoteRepo, ref, "--verbose", "--no-progress", "--prune", "--no-auto-gc"}
18881888
if git.depth > 0 {
18891889
args = append(args, "--depth", strconv.Itoa(git.depth))
18901890
} else {
@@ -2057,7 +2057,7 @@ func (git *repoSync) CallAskPassURL(ctx context.Context) error {
20572057
}
20582058
}
20592059

2060-
if err := git.StoreCredentials(ctx, git.repo, username, password); err != nil {
2060+
if err := git.StoreCredentials(ctx, git.remoteRepo, username, password); err != nil {
20612061
return err
20622062
}
20632063

@@ -2146,7 +2146,7 @@ func (git *repoSync) RefreshGitHubAppToken(ctx context.Context, githubBaseURL, p
21462146
username := "-"
21472147
password := tokenResponse.Token
21482148

2149-
if err := git.StoreCredentials(ctx, git.repo, username, password); err != nil {
2149+
if err := git.StoreCredentials(ctx, git.remoteRepo, username, password); err != nil {
21502150
return err
21512151
}
21522152

0 commit comments

Comments
 (0)