From 81256f5ae9f50d2dda819c7750147281402c802b Mon Sep 17 00:00:00 2001 From: Jonathan Dygert <131683647+jdygert-spok@users.noreply.github.com> Date: Mon, 17 Jul 2023 16:48:34 -0600 Subject: [PATCH] Invert check of BSSL_GIT_NO_CHECKOUT (#2) --- .github/workflows/main.yml | 2 +- build.rs | 35 ++++++++++++++++------------------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 41e486f..3efd1ba 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -59,4 +59,4 @@ jobs: with: gh-token: ${{ secrets.CC_BUILD_TOKEN }} - name: Build code - run: cargo build --verbose + run: cargo build --verbose --release diff --git a/build.rs b/build.rs index 109c055..08b8920 100644 --- a/build.rs +++ b/build.rs @@ -433,25 +433,22 @@ fn find_bssl_sources() -> Result { } println!("cargo:rerun-if-env-changed={BSSL_GIT_NO_CHECKOUT_VAR}"); - match env::var(BSSL_GIT_NO_CHECKOUT_VAR) { - Ok(v) if v == "1" => { - // Make sure we're at the correct commit. - Command::new("git") - .arg("reset") - .arg("--hard") - .arg("head") - .current_dir(&path) - .status()? - .exit_ok()?; - let hash = env::var(BSSL_GIT_HASH_VAR).unwrap_or(BSSL_GIT_HASH.to_owned()); - Command::new("git") - .arg("checkout") - .arg(hash) - .current_dir(&path) - .status()? - .exit_ok()?; - } - _ => {} + if env::var(BSSL_GIT_NO_CHECKOUT_VAR).as_deref() != Ok("1") { + // Make sure we're at the correct commit. + Command::new("git") + .arg("reset") + .arg("--hard") + .arg("HEAD") + .current_dir(&path) + .status()? + .exit_ok()?; + let hash = env::var(BSSL_GIT_HASH_VAR).unwrap_or(BSSL_GIT_HASH.to_owned()); + Command::new("git") + .arg("checkout") + .arg(hash) + .current_dir(&path) + .status()? + .exit_ok()?; } Ok(Sources::Raw(path)) }