From f3e9f274566ed8a5b2afa34e43727713c2f5f122 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Mon, 14 Aug 2023 09:58:57 +0100 Subject: [PATCH] Fix nix build (#1171) I forgot nix builds in a sandbox, so my laziness earlier meant that the nix build fails - sandbox has no git! --- atuin/build.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/atuin/build.rs b/atuin/build.rs index 06df646..f24cf1b 100644 --- a/atuin/build.rs +++ b/atuin/build.rs @@ -1,10 +1,11 @@ use std::process::Command; fn main() { - let output = Command::new("git") - .args(["rev-parse", "HEAD"]) - .output() - .unwrap(); + let output = Command::new("git").args(["rev-parse", "HEAD"]).output(); - let git_hash = String::from_utf8(output.stdout).unwrap(); - println!("cargo:rustc-env=GIT_HASH={}", git_hash); + let sha = match output { + Ok(sha) => String::from_utf8(sha.stdout).unwrap(), + Err(_) => String::from("NO_GIT"), + }; + + println!("cargo:rustc-env=GIT_HASH={}", sha); }