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