diff --git a/src/server/actors/repo/branch.rs b/src/server/actors/repo/branch.rs index 5fb901b4..0b675b8a 100644 --- a/src/server/actors/repo/branch.rs +++ b/src/server/actors/repo/branch.rs @@ -166,7 +166,6 @@ fn find_next_commit_on_dev( } // advance main branch to the commit 'next' -#[allow(dead_code)] pub async fn advance_main( next: forge::Commit, repo_details: config::RepoDetails, @@ -174,31 +173,19 @@ pub async fn advance_main( addr: Addr, ) { info!("Advance Main"); - let user = repo_details.forge.user; - let token = repo_details.forge.token; - let hostname = repo_details.forge.hostname; - let path = repo_details.repo; - let main = repo_config.branches().main(); - let command = - format!("/usr/bin/git push https://{user}:{token}@{hostname}/{path}.git {next}:{main}"); - info!("Running command: {}", command); - match gix::command::prepare(command) - .with_shell_allow_argument_splitting() - .spawn() - { - Ok(mut child) => { - match child.wait() { - Ok(exit_status) => { - info!(%exit_status, "Advance Next Success"); - addr.do_send(StartRepo); - } - Err(err) => { - warn!(?err, "Advance Next Failed (wait)") - } - }; + let result = reset( + &repo_config.branches().main(), + next, + ResetForce::Normal, + &repo_details, + ); + match result { + Ok(_) => { + info!("Advance Next Success"); + addr.do_send(StartRepo); } Err(err) => { - warn!(?err, "Advance Next Failed (spawn)") + warn!(?err, "Advance Next Failed") } }; }