From 6969bd4f21409a9934114c727293b1a47116f6da Mon Sep 17 00:00:00 2001 From: benluiwj Date: Sun, 29 Sep 2024 11:42:58 +0800 Subject: [PATCH] fix git switch function --- check_diff/src/lib.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/check_diff/src/lib.rs b/check_diff/src/lib.rs index 487f5c751e4..79f0d91ccf3 100644 --- a/check_diff/src/lib.rs +++ b/check_diff/src/lib.rs @@ -6,8 +6,6 @@ use std::str::Utf8Error; use std::string::FromUtf8Error; use tracing::info; -// ========= Start of error enums =========== - pub enum CheckDiffError { /// Git related errors FailedGit(GitError), @@ -56,8 +54,6 @@ impl From for GitError { } } -// ========= End of error enums =========== - // will be used in future PRs, just added to make the compiler happy #[allow(dead_code)] pub struct CheckDiffRunners { @@ -153,7 +149,9 @@ pub fn git_fetch(branch_name: &str) -> Result<(), GitError> { pub fn git_switch(arg: &str, should_detach: bool) -> Result<(), GitError> { let detach_arg = if should_detach { "--detach" } else { "" }; - let git_cmd = Command::new("git").args([arg, detach_arg]).output()?; + let git_cmd = Command::new("git") + .args(["switch", arg, detach_arg]) + .output()?; if !git_cmd.status.success() { let error = GitError::FailedSwitch {