diff options
Diffstat (limited to 'internal/sync/repository_setup.go')
| -rw-r--r-- | internal/sync/repository_setup.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/internal/sync/repository_setup.go b/internal/sync/repository_setup.go index 9bb0c2f..a6f01a9 100644 --- a/internal/sync/repository_setup.go +++ b/internal/sync/repository_setup.go @@ -54,14 +54,15 @@ func (s *Syncer) setupNewRepository(repoPath string) error { continue // Skip the first org we already cloned from } org := &s.config.Organizations[i] + remoteName := s.getRemoteName(org) // Skip backup locations unless backup sync is currently active. - if org.BackupLocation && !s.backupActive() { + if org.BackupLocation && !s.backupActive(remoteName) { continue } if err := s.addRemote(repoPath, org); err != nil { - return fmt.Errorf("failed to add remote %s: %w", s.getRemoteName(org), err) + return fmt.Errorf("failed to add remote %s: %w", remoteName, err) } } @@ -75,14 +76,13 @@ func (s *Syncer) setupExistingRepository(repoPath string) error { // Check and add any missing remotes for i := range s.config.Organizations { org := &s.config.Organizations[i] + remoteName := s.getRemoteName(org) // Skip backup locations unless backup sync is currently active. - if org.BackupLocation && !s.backupActive() { + if org.BackupLocation && !s.backupActive(remoteName) { continue } - remoteName := s.getRemoteName(org) - // Check if remote exists cmd := exec.Command("git", "-C", repoPath, "remote", "get-url", remoteName) if err := cmd.Run(); err != nil { @@ -101,13 +101,13 @@ func (s *Syncer) getRemotesMap() map[string]*config.Organization { remotes := make(map[string]*config.Organization) for i := range s.config.Organizations { org := &s.config.Organizations[i] + remoteName := s.getRemoteName(org) // Skip backup locations unless backup sync is currently active. - if org.BackupLocation && !s.backupActive() { + if org.BackupLocation && !s.backupActive(remoteName) { continue } - remoteName := s.getRemoteName(org) remotes[remoteName] = org } return remotes |
