From 4c4ac4df25d4f644357ba73ba0bb18631d11394b Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 13 Apr 2024 16:22:49 +0100 Subject: [PATCH] fix(repo/branch): revalidate positions in more conditions - when next has no commits - when couldn't reset next to a commit (e.g. commit was WIP) --- src/server/actors/repo/branch.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/server/actors/repo/branch.rs b/src/server/actors/repo/branch.rs index a67b510..7ccb7a2 100644 --- a/src/server/actors/repo/branch.rs +++ b/src/server/actors/repo/branch.rs @@ -163,28 +163,24 @@ pub async fn advance_next( let next_commit = find_next_commit_on_dev(next, dev_commit_history); let Some(commit) = next_commit else { warn!("No commits to advance next to"); + revalidate_positions(addr).await; return; }; if let Some(problem) = validate_commit_message(commit.message()) { warn!("Can't advance next to commit '{}': {}", commit, problem); + revalidate_positions(addr).await; return; } info!("Advancing next to commit '{}'", commit); - match git.reset( + if let Err(err) = git.reset( &repo_config.branches().next(), commit.into(), ResetForce::None, &repo_details, ) { - Ok(_) => { - // TODO : (#18) sleep and restart while we don't have webhooks - tokio::time::sleep(std::time::Duration::from_secs(10)).await; - addr.do_send(ValidateRepo); - } - Err(err) => { - warn!(?err, "Failed") - } + warn!(?err, "Failed") }; + revalidate_positions(addr).await; } #[tracing::instrument]