From 7b1b36b8c7e448d1d170c8c6e1f88bb766163fbb Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 26 May 2026 20:38:49 +0530 Subject: Fix push_target remote reuse and non-fatal per-repo errors - git_mirror: reuse existing push_target remote via remote_set_url instead of failing on 'remote already exists' on subsequent cycles - mirror_cycle: catch per-repo errors instead of propagating with ? so one failed clone doesn't abort the remaining 87 repos - Add PLAN.md with bug tracking checklist --- src/git_mirror.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/git_mirror.rs') diff --git a/src/git_mirror.rs b/src/git_mirror.rs index 47c0442..6866de3 100644 --- a/src/git_mirror.rs +++ b/src/git_mirror.rs @@ -134,7 +134,18 @@ impl GitMirror { let repo = git2::Repository::open(repo_path) .with_context(|| format!("failed to open bare repo at {:?}", repo_path))?; - let mut remote = repo.remote("push_target", target_url)?; + let remote_name = "push_target"; + + match repo.find_remote(remote_name) { + Ok(_) => { + repo.remote_set_url(remote_name, target_url)?; + } + Err(_) => { + repo.remote(remote_name, target_url)?; + } + } + + let mut remote = repo.find_remote(remote_name)?; let mut callbacks = RemoteCallbacks::new(); callbacks.credentials(|_url, _username, _allowed| git2::Cred::default()); -- cgit v1.2.3