Skip to content

Commit

Permalink
Update git.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Joker666 committed Aug 5, 2024
1 parent 1263f27 commit 9ffbc66
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,14 @@ cat | RUKU_ROOT="{}" {} git-hook {}
.step(&format!("Checking out the latest code from branch: {}", branch));

// Get the current branch
let current_branch = run_fun!(
git rev-parse --abbrev-ref HEAD
)
.unwrap_or_else(|e| {
let current_branch = run_fun!(git rev-parse --abbrev-ref HEAD).unwrap_or_else(|e| {
self.log.error(&format!("Error getting current branch: {}", e));
std::process::exit(1);
});

// Check if the current branch is the same as the target branch
if current_branch.trim() != branch {
run_cmd!(
git checkout $branch;
)
.unwrap_or_else(|e| {
run_cmd!(git checkout $branch).unwrap_or_else(|e| {
self.log.error(&format!("Error checking out latest code: {}", e));
std::process::exit(1);
});
Expand Down

0 comments on commit 9ffbc66

Please sign in to comment.