@@ -109,7 +109,7 @@ const defaultDirMode = os.FileMode(0775) // subject to umask
109
109
type repoSync struct {
110
110
cmd string // the git command to run
111
111
root absPath // absolute path to the root directory
112
- repo string // remote repo to sync
112
+ remoteRepo string // remote repo to sync
113
113
ref string // the ref to sync
114
114
depth int // for shallow sync
115
115
submodules submodulesMode // how to handle submodules
@@ -617,7 +617,7 @@ func main() {
617
617
git := & repoSync {
618
618
cmd : * flGitCmd ,
619
619
root : absRoot ,
620
- repo : * flRepo ,
620
+ remoteRepo : * flRepo ,
621
621
ref : * flRef ,
622
622
depth : * flDepth ,
623
623
submodules : submodulesMode (* flSubmodules ),
@@ -1124,12 +1124,12 @@ func (git *repoSync) initRepo(ctx context.Context) error {
1124
1124
return err
1125
1125
}
1126
1126
// 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 {
1128
1128
return err
1129
1129
}
1130
- } else if strings .TrimSpace (stdout ) != git .repo {
1130
+ } else if strings .TrimSpace (stdout ) != git .remoteRepo {
1131
1131
// 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 {
1133
1133
return err
1134
1134
}
1135
1135
}
@@ -1555,7 +1555,7 @@ func (git *repoSync) currentWorktree() (worktree, error) {
1555
1555
// and tries to clean up any detritus. This function returns whether the
1556
1556
// current hash has changed and what the new hash is.
1557
1557
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 ))
1559
1559
1560
1560
if err := refreshCreds (ctx ); err != nil {
1561
1561
return false , "" , fmt .Errorf ("credential refresh failed: %w" , err )
@@ -1680,11 +1680,11 @@ func (git *repoSync) SyncRepo(ctx context.Context, refreshCreds func(context.Con
1680
1680
1681
1681
// fetch retrieves the specified ref from the upstream repo.
1682
1682
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 ))
1684
1684
1685
1685
// Fetch the ref and do some cleanup, setting or un-setting the repo's
1686
1686
// 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" }
1688
1688
if git .depth > 0 {
1689
1689
args = append (args , "--depth" , strconv .Itoa (git .depth ))
1690
1690
} else {
@@ -1842,7 +1842,7 @@ func (git *repoSync) CallAskPassURL(ctx context.Context) error {
1842
1842
}
1843
1843
}
1844
1844
1845
- if err := git .StoreCredentials (ctx , git .repo , username , password ); err != nil {
1845
+ if err := git .StoreCredentials (ctx , git .remoteRepo , username , password ); err != nil {
1846
1846
return err
1847
1847
}
1848
1848
0 commit comments