fix git version with shallow clones (#794)

* fix git version with shallow clones

* more
This commit is contained in:
Logan McNaughton
2026-04-22 01:08:54 -06:00
committed by GitHub
parent c4771f91e0
commit 03f83fe917
3 changed files with 19 additions and 7 deletions
Generated
+1 -1
View File
@@ -2102,7 +2102,7 @@ dependencies = [
[[package]]
name = "gopher64"
version = "1.1.17"
version = "1.1.16"
dependencies = [
"bindgen",
"cc",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "gopher64"
version = "1.1.17"
version = "1.1.16"
edition = "2024"
rust-version = "1.95.0"
+17 -5
View File
@@ -277,12 +277,24 @@ fn main() {
.compile("simd");
}
let git_output = std::process::Command::new("git")
.args(["describe", "--always", "--dirty"])
.output()
.unwrap();
let mut git_output = std::process::Command::new("git");
git_output.args(["describe", "--dirty"]);
let git_describe = String::from_utf8(git_output.stdout).unwrap();
let git_describe = if let Ok(git_output) = git_output.output()
&& git_output.status.success()
{
String::from_utf8(git_output.stdout).unwrap()
} else if let Ok(git_output) = git_output.args(["--always"]).output()
&& git_output.status.success()
{
format!(
"v{}-{}",
env!("CARGO_PKG_VERSION"),
String::from_utf8(git_output.stdout).unwrap()
)
} else {
panic!("Failed to get git describe");
};
println!("cargo:rustc-env=GIT_DESCRIBE={git_describe}");
println!("cargo:rerun-if-env-changed=NETPLAY_ID");