diff options
| author | Paul Buetow <paul@buetow.org> | 2025-07-03 22:38:37 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-07-03 22:38:37 +0300 |
| commit | 64095a2c8d5a3a72c55d7bd0737c5542a5aeee09 (patch) | |
| tree | 0af2501374550e8fdadd4df00d245c6260c0305d /internal/sync/branch_sync.go | |
| parent | 0c072d964d4d07e69d1c0af1f3b09f9adc543571 (diff) | |
feat: add SSH backup locations with --backup flagv0.2.0
- Add support for SSH backup locations (e.g., paul@server:git/)
- Backup locations are one-way only (push only, never pull)
- Automatic bare repository creation on SSH servers
- Add --backup flag to opt-in to backup syncing
- Backup locations are disabled by default for offline resilience
- Update version to 0.2.0
This allows users to maintain private backups on home servers that may
be offline without affecting regular sync operations.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'internal/sync/branch_sync.go')
| -rw-r--r-- | internal/sync/branch_sync.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/sync/branch_sync.go b/internal/sync/branch_sync.go index 1bf8b79..02f8964 100644 --- a/internal/sync/branch_sync.go +++ b/internal/sync/branch_sync.go @@ -10,7 +10,11 @@ import ( func (s *Syncer) trackRemotesWithBranch(branch string, remotes map[string]*config.Organization) map[string]bool { remotesWithBranch := make(map[string]bool) - for remoteName := range remotes { + for remoteName, org := range remotes { + // Skip checking backup locations as we don't sync from them + if org.BackupLocation { + continue + } if s.remoteBranchExists(remoteName, branch) { remotesWithBranch[remoteName] = true } @@ -48,7 +52,7 @@ func pushToAllRemotes(branch string, remotes map[string]*config.Organization, re fmt.Printf(" Pushing to %s (%s)...\n", remoteName, org.Host) } - if err := pushBranch(remoteName, branch, remoteHasBranch); err != nil { + if err := pushBranchWithBackupSupport(remoteName, branch, remoteHasBranch, org); err != nil { return err } } |
