Skip to content

Commit

Permalink
fixes for checking short commit id's
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjamuffin99 committed Nov 6, 2024
1 parent 1ac9248 commit 50a9386
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/commands/check_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,20 @@ pub fn compare_haxelib_to_hmm(deps: &Dependancies) -> Result<Vec<HaxelibStatus>>

let branch_commit = head_ref.to_string();

if haxelib.vcs_ref.as_ref().unwrap() != &head_ref_string
&& (haxelib.vcs_ref.as_ref().unwrap() != &branch_name
&& haxelib.vcs_ref.as_ref().unwrap() != &branch_commit)
{
let intended_commit = haxelib.vcs_ref.as_ref().unwrap();

let proper_commit: Result<(), String> = match intended_commit {
commit if head_ref_string.starts_with(commit) => core::result::Result::Ok(()),
commit if !&branch_name.starts_with(commit) => {
Err("doesn't match branch name".to_string())
}
commit if !&branch_commit.starts_with(commit) => {
Err("doesn't match branch commit".to_string())
}
_ => core::result::Result::Ok(()),
};

if proper_commit.is_err() {
println!(
"{} {}",
haxelib.name.red().bold(),
Expand Down

0 comments on commit 50a9386

Please sign in to comment.