From e87e099c0d7bcb6b907e792b3e445e1adf42e941 Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Thu, 10 Aug 2023 17:04:54 -0700 Subject: [PATCH] `cli version`: Trim the commit id 16 characters 16 characters ought to be enough for anyone :) --- cli/build.rs | 3 ++- cli/tests/test_global_opts.rs | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cli/build.rs b/cli/build.rs index 50a26ee383..a317221560 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -41,7 +41,8 @@ fn main() -> std::io::Result<()> { } println!("cargo:rerun-if-env-changed=NIX_JJ_GIT_HASH"); - if let Some((date, git_hash)) = get_git_date_and_hash() { + if let Some((date, mut git_hash)) = get_git_date_and_hash() { + git_hash.truncate(16); println!( "cargo:rustc-env=JJ_VERSION={}-{}-{}", version, date, git_hash diff --git a/cli/tests/test_global_opts.rs b/cli/tests/test_global_opts.rs index 35d5c79d17..55cfefc98a 100644 --- a/cli/tests/test_global_opts.rs +++ b/cli/tests/test_global_opts.rs @@ -71,9 +71,7 @@ fn test_no_subcommand() { let sanitized = stdout.replace(|c: char| c.is_ascii_hexdigit(), "?"); assert_matches!( sanitized.as_str(), - "jj ?.?.?\n" - | "jj ?.?.?-????????-????????????????????????????????????????\n" - | "jj ?.?.?-nix-????????????????????????????????????????\n" + "jj ?.?.?\n" | "jj ?.?.?-????????-????????????????\n" | "jj ?.?.?-nix-????????????????\n" ); let stdout = test_env.jj_cmd_success(test_env.env_root(), &["-R", "repo"]);