From 2d99d4bee1a17013e30780d6a1e57f85e073824e Mon Sep 17 00:00:00 2001 From: 0hypercube <0hypercube@gmail.com> Date: Wed, 23 Aug 2023 21:54:33 +0100 Subject: [PATCH] Fix commit branch when not in pull request --- editor/build.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/editor/build.rs b/editor/build.rs index ef3c4f9d..bf3ac8aa 100644 --- a/editor/build.rs +++ b/editor/build.rs @@ -17,9 +17,8 @@ fn main() { // They are accessed with the `env!("...")` macro in the codebase. println!("cargo:rustc-env=GRAPHITE_GIT_COMMIT_DATE={}", git_command(&["log", "-1", "--format=%cd"])); println!("cargo:rustc-env=GRAPHITE_GIT_COMMIT_HASH={}", git_command(&["rev-parse", "HEAD"])); - println!( - "cargo:rustc-env=GRAPHITE_GIT_COMMIT_BRANCH={}", - std::env::var("GITHUB_HEAD_REF").unwrap_or_else(|_| git_command(&["name-rev", "--name-only", "HEAD"])) - ); + let branch = std::env::var("GITHUB_HEAD_REF").unwrap_or_default(); + let branch = if branch.is_empty() { git_command(&["name-rev", "--name-only", "HEAD"]) } else { branch }; + println!("cargo:rustc-env=GRAPHITE_GIT_COMMIT_BRANCH={}", branch); println!("cargo:rustc-env=GRAPHITE_RELEASE_SERIES={}", GRAPHITE_RELEASE_SERIES); }