@@ -117,7 +117,7 @@ const defaultDirMode = os.FileMode(0775) // subject to umask
117
117
type repoSync struct {
118
118
cmd string // the git command to run
119
119
root absPath // absolute path to the root directory
120
- repo string // remote repo to sync
120
+ remoteRepo string // remote repo to sync
121
121
ref string // the ref to sync
122
122
depth int // for shallow sync
123
123
submodules submodulesMode // how to handle submodules
@@ -706,7 +706,7 @@ func main() {
706
706
git := & repoSync {
707
707
cmd : * flGitCmd ,
708
708
root : absRoot ,
709
- repo : * flRepo ,
709
+ remoteRepo : * flRepo ,
710
710
ref : * flRef ,
711
711
depth : * flDepth ,
712
712
submodules : submodulesMode (* flSubmodules ),
@@ -1260,12 +1260,12 @@ func (git *repoSync) initRepo(ctx context.Context) error {
1260
1260
return err
1261
1261
}
1262
1262
// 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 {
1264
1264
return err
1265
1265
}
1266
- } else if strings .TrimSpace (stdout ) != git .repo {
1266
+ } else if strings .TrimSpace (stdout ) != git .remoteRepo {
1267
1267
// 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 {
1269
1269
return err
1270
1270
}
1271
1271
}
@@ -1715,7 +1715,7 @@ func (git *repoSync) currentWorktree() (worktree, error) {
1715
1715
// and tries to clean up any detritus. This function returns whether the
1716
1716
// current hash has changed and what the new hash is.
1717
1717
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 ))
1719
1719
1720
1720
if err := refreshCreds (ctx ); err != nil {
1721
1721
return false , "" , fmt .Errorf ("credential refresh failed: %w" , err )
@@ -1840,11 +1840,11 @@ func (git *repoSync) SyncRepo(ctx context.Context, refreshCreds func(context.Con
1840
1840
1841
1841
// fetch retrieves the specified ref from the upstream repo.
1842
1842
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 ))
1844
1844
1845
1845
// Fetch the ref and do some cleanup, setting or un-setting the repo's
1846
1846
// 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" }
1848
1848
if git .depth > 0 {
1849
1849
args = append (args , "--depth" , strconv .Itoa (git .depth ))
1850
1850
} else {
@@ -2014,7 +2014,7 @@ func (git *repoSync) CallAskPassURL(ctx context.Context) error {
2014
2014
}
2015
2015
}
2016
2016
2017
- if err := git .StoreCredentials (ctx , git .repo , username , password ); err != nil {
2017
+ if err := git .StoreCredentials (ctx , git .remoteRepo , username , password ); err != nil {
2018
2018
return err
2019
2019
}
2020
2020
@@ -2102,7 +2102,7 @@ func (git *repoSync) RefreshGitHubAppToken(ctx context.Context, githubBaseURL, p
2102
2102
username := "-"
2103
2103
password := tokenResponse .Token
2104
2104
2105
- if err := git .StoreCredentials (ctx , git .repo , username , password ); err != nil {
2105
+ if err := git .StoreCredentials (ctx , git .remoteRepo , username , password ); err != nil {
2106
2106
return err
2107
2107
}
2108
2108
0 commit comments