summaryrefslogtreecommitdiff
path: root/internal/sync/branch_sync.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-28 10:16:18 +0200
committerPaul Buetow <paul@buetow.org>2026-03-28 10:16:18 +0200
commit73c6a37ecf0aac04711e5624455743b3493a7ef5 (patch)
treeac58cce0dcd03ccac3f5f3e313a46ebe9d352b30 /internal/sync/branch_sync.go
parent1615abaacccdbb5002404a77270fd333ce8ad718 (diff)
feat(sync): auto-sync full backups and showcase cgit linksv0.17.0main
Diffstat (limited to 'internal/sync/branch_sync.go')
-rw-r--r--internal/sync/branch_sync.go22
1 files changed, 20 insertions, 2 deletions
diff --git a/internal/sync/branch_sync.go b/internal/sync/branch_sync.go
index a667ee2..a053e78 100644
--- a/internal/sync/branch_sync.go
+++ b/internal/sync/branch_sync.go
@@ -40,9 +40,27 @@ func mergeFromRemotes(repoPath, branch string, remotesWithBranch map[string]bool
return nil
}
+// handlePushError decides whether a push error should stop sync or only disable backup for this session.
+func (s *Syncer) handlePushError(remoteName string, org *config.Organization, err error) error {
+ if err == nil {
+ return nil
+ }
+
+ if org != nil && org.BackupLocation {
+ s.disableBackupForSession(remoteName, err)
+ return nil
+ }
+
+ return err
+}
+
// pushToAllRemotes pushes the branch to all configured remotes
-func pushToAllRemotes(repoPath, branch string, remotes map[string]*config.Organization, remotesWithBranch map[string]bool) error {
+func (s *Syncer) pushToAllRemotes(repoPath, branch string, remotes map[string]*config.Organization, remotesWithBranch map[string]bool) error {
for remoteName, org := range remotes {
+ if org.BackupLocation && !s.backupActive() {
+ continue
+ }
+
// Check if this remote has the branch
remoteHasBranch := remotesWithBranch[remoteName]
@@ -52,7 +70,7 @@ func pushToAllRemotes(repoPath, branch string, remotes map[string]*config.Organi
fmt.Printf(" Pushing to %s (%s)...\n", remoteName, org.Host)
}
- if err := pushBranchWithBackupSupport(repoPath, remoteName, branch, remoteHasBranch, org); err != nil {
+ if err := s.handlePushError(remoteName, org, pushBranchWithBackupSupport(repoPath, remoteName, branch, remoteHasBranch, org)); err != nil {
return err
}
}