Skip to content

Commit

Permalink
chore: remove git2 from built (#4227)
Browse files Browse the repository at this point in the history
since we switched to gix it isn't worth compiling all of libgit2 for sometimes displaying the git sha in `mise -v`
  • Loading branch information
jdx authored Jan 26, 2025
1 parent 3463ef1 commit d88870c
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 50 deletions.
38 changes: 0 additions & 38 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ self_update = { version = "0.42", default-features = false, features = [
sevenz-rust = "0.6"

[build-dependencies]
built = { version = "0.7", features = ["chrono", "git2"] }
built = { version = "0.7", features = ["chrono"] }
cfg_aliases = "0.2"
heck = "0.5"
toml = "0.8"
Expand Down
4 changes: 0 additions & 4 deletions src/build_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ pub mod built_info {
include!(concat!(env!("OUT_DIR"), "/built.rs"));
}

pub fn git_sha() -> &'static Option<&'static str> {
&built_info::GIT_COMMIT_HASH_SHORT
}

pub static BUILD_TIME: Lazy<DateTime<FixedOffset>> =
Lazy::new(|| DateTime::parse_from_rfc2822(built_info::BUILT_TIME_UTC).unwrap());

Expand Down
9 changes: 2 additions & 7 deletions src/cli/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use eyre::Result;
use std::sync::LazyLock as Lazy;
use versions::Versioning;

use crate::build_time::{git_sha, BUILD_TIME};
use crate::build_time::BUILD_TIME;
use crate::cli::self_update::SelfUpdate;
#[cfg(not(test))]
use crate::config::Settings;
Expand Down Expand Up @@ -44,7 +44,6 @@ impl Version {
"os": *OS,
"arch": *ARCH,
"build_time": BUILD_TIME.to_string(),
"git_sha": git_sha(),
});
println!("{}", serde_json::to_string_pretty(&json)?);
Ok(())
Expand All @@ -67,11 +66,7 @@ pub static VERSION: Lazy<String> = Lazy::new(|| {
v.push_str("-DEBUG");
};
let build_time = BUILD_TIME.format("%Y-%m-%d");
let extra = match git_sha() {
Some(sha) => format!("({} {})", sha, build_time),
_ => format!("({})", build_time),
};
format!("{v} {os}-{arch} {extra}", os = *OS, arch = *ARCH)
format!("{v} {os}-{arch} ({build_time})", os = *OS, arch = *ARCH)
});

static AFTER_LONG_HELP: &str = color_print::cstr!(
Expand Down

0 comments on commit d88870c

Please sign in to comment.