From 2c4303137ab13bcd623c0df6489cd7935abb6a09 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 | 4 ++-- cli/tests/test_global_opts.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/build.rs b/cli/build.rs index 0433ed3f0d..e41931e792 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -44,8 +44,8 @@ fn main() -> std::io::Result<()> { } println!("cargo:rerun-if-env-changed=NIX_JJ_GIT_HASH"); - // TODO: timestamp can be "nix" - if let Some((maybe_date, git_hash)) = get_git_timestamp_and_hash() { + if let Some((maybe_date, mut git_hash)) = get_git_timestamp_and_hash() { + git_hash.truncate(16); println!( "cargo:rustc-env=JJ_VERSION={}-{}-{}", version, diff --git a/cli/tests/test_global_opts.rs b/cli/tests/test_global_opts.rs index ac81a843e4..8b9bdd1c8b 100644 --- a/cli/tests/test_global_opts.rs +++ b/cli/tests/test_global_opts.rs @@ -72,9 +72,9 @@ fn test_no_subcommand() { assert_matches!( sanitized.as_str(), "jj ?.??.?\n" - | "jj ?.??.?-????????-????????????????????????????????????????\n" + | "jj ?.??.?-????????-????????????????\n" // `dateunknown` turns into `??t?unknown` since d,a,e are hex digits. - | "jj ?.??.?-??t?unknown-????????????????????????????????????????\n" + | "jj ?.??.?-??t?unknown-????????????????\n" ); let stdout = test_env.jj_cmd_success(test_env.env_root(), &["-R", "repo"]);