Skip to content

Commit

Permalink
cli version: Trim the commit id 16 characters
Browse files Browse the repository at this point in the history
16 characters ought to be enough for anyone :)
  • Loading branch information
ilyagr committed Jun 2, 2024
1 parent 0288cf6 commit be4f246
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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((git_hash, maybe_date)) = get_git_timestamp_and_hash() {
if let Some((mut git_hash, maybe_date)) = get_git_timestamp_and_hash() {
git_hash.truncate(16);
println!(
"cargo:rustc-env=JJ_VERSION={}-{}-{}",
version,
Expand Down
4 changes: 2 additions & 2 deletions cli/tests/test_global_opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ fn test_version() {
let sanitized = stdout.replace(|c: char| c.is_ascii_hexdigit(), "?");
let expected = [
"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",
];
assert!(
expected.contains(&sanitized.as_str()),
Expand Down

0 comments on commit be4f246

Please sign in to comment.