refactor: rename ResetForce::Normal as None

This commit is contained in:
Paul Campbell 2024-04-11 18:09:57 +01:00
parent e0b15712c2
commit ec258bca97

View file

@ -124,7 +124,7 @@ pub async fn advance_next(
match reset( match reset(
&repo_config.branches().next(), &repo_config.branches().next(),
commit, commit,
ResetForce::Normal, ResetForce::None,
&repo_details, &repo_details,
) { ) {
Ok(_) => { Ok(_) => {
@ -162,7 +162,7 @@ pub async fn advance_main(
match reset( match reset(
&repo_config.branches().main(), &repo_config.branches().main(),
next, next,
ResetForce::Normal, ResetForce::None,
&repo_details, &repo_details,
) { ) {
Ok(_) => { Ok(_) => {
@ -194,8 +194,7 @@ impl Display for GitRef {
} }
pub enum ResetForce { pub enum ResetForce {
#[allow(dead_code)] None,
Normal,
Force(GitRef), Force(GitRef),
} }
pub fn reset( pub fn reset(
@ -211,7 +210,7 @@ pub fn reset(
let path = &repo_details.repo; let path = &repo_details.repo;
let origin = format!("https://{user}:{token}@{hostname}/{path}.git"); let origin = format!("https://{user}:{token}@{hostname}/{path}.git");
let force = match reset_force { let force = match reset_force {
ResetForce::Normal => "".to_string(), ResetForce::None => "".to_string(),
ResetForce::Force(old_ref) => format!("--force-with-lease={branch}:{old_ref}"), ResetForce::Force(old_ref) => format!("--force-with-lease={branch}:{old_ref}"),
}; };
let command = format!("/usr/bin/git push {origin} {gitref}:{branch} {force}"); let command = format!("/usr/bin/git push {origin} {gitref}:{branch} {force}");