Skip to content

Commit

Permalink
some check command cleanup for when git directory doesnt exist
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjamuffin99 committed Jan 15, 2025
1 parent b8136ca commit a558c07
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/commands/check_command.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{fs::File, path::Path};

use crate::hmm::dependencies::Dependancies;
use crate::hmm::haxelib::{Haxelib, HaxelibType};
use crate::hmm::{dependencies::Dependancies};
use anyhow::{anyhow, Context, Result};
use console::Emoji;
use gix::hash::Prefix;
Expand All @@ -17,6 +17,7 @@ pub struct HaxelibStatus<'a> {
#[derive(Debug, PartialEq)]
pub enum InstallType {
Missing, // Needs to be installed
MissingGit, // Needs to be cloned
Outdated, // Installed but wrong version
AlreadyInstalled, // Correctly installed
Conflict, // Version conflicts between dependencies
Expand Down Expand Up @@ -97,6 +98,21 @@ pub fn compare_haxelib_to_hmm(deps: &Dependancies) -> Result<Vec<HaxelibStatus>>
HaxelibType::Git => {
let repo_path = haxelib_path.join("git");

if !repo_path.exists() {
println!(
"{} {}",
haxelib.name.red().bold(),
"is not cloned / installed (via git)".red()
);
println!(
"Expected: {} | Installed: {}",
haxelib.vcs_ref.as_ref().unwrap().red(),
"None".red()
);
install_status.push(HaxelibStatus::new(haxelib, InstallType::MissingGit));
continue;
}

let repo = match gix::discover(&repo_path) {
Ok(r) => r,
Err(e) => {
Expand Down

0 comments on commit a558c07

Please sign in to comment.