Skip to content

Commit

Permalink
fix git switch function
Browse files Browse the repository at this point in the history
  • Loading branch information
benluiwj committed Sep 29, 2024
1 parent 42fec76 commit 6969bd4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions check_diff/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -56,8 +54,6 @@ impl From<io::Error> 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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6969bd4

Please sign in to comment.