diff options
Diffstat (limited to 'src/git_remote_helper.rs')
| -rw-r--r-- | src/git_remote_helper.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/git_remote_helper.rs b/src/git_remote_helper.rs index de49275..d0c0005 100644 --- a/src/git_remote_helper.rs +++ b/src/git_remote_helper.rs | |||
| @@ -270,6 +270,24 @@ async fn push( | |||
| 270 | ) | 270 | ) |
| 271 | .await?; | 271 | .await?; |
| 272 | 272 | ||
| 273 | // silently push to any other git servers | ||
| 274 | for (i, git_server_url) in repo_ref.git_server.iter().enumerate() { | ||
| 275 | // we have already pushed to the first one | ||
| 276 | if i.gt(&0) { | ||
| 277 | if let Ok(mut git_server_remote) = git_repo.git_repo.remote_anonymous(git_server_url) { | ||
| 278 | let auth = GitAuthenticator::default(); | ||
| 279 | let git_config = git_repo.git_repo.config()?; | ||
| 280 | let mut push_options = git2::PushOptions::new(); | ||
| 281 | let mut remote_callbacks = git2::RemoteCallbacks::new(); | ||
| 282 | remote_callbacks.credentials(auth.credentials(&git_config)); | ||
| 283 | push_options.remote_callbacks(remote_callbacks); | ||
| 284 | let _ = git_server_remote.push(&refspecs, Some(&mut push_options)); | ||
| 285 | let _ = git_server_remote.disconnect(); | ||
| 286 | } | ||
| 287 | } | ||
| 288 | } | ||
| 289 | // todo report on errors | ||
| 290 | |||
| 273 | println!(); | 291 | println!(); |
| 274 | Ok(()) | 292 | Ok(()) |
| 275 | } | 293 | } |