We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3be2b5c commit ead877aCopy full SHA for ead877a
build.rs
@@ -1,15 +1,9 @@
1
+use std::fs::read_to_string;
2
+
3
fn main() {
4
let git_hash = option_env!("TRAVIS_COMMIT")
- .map(ToOwned::to_owned)
- .unwrap_or_else(|| {
5
- let stdout = std::process::Command::new("git")
6
- .arg("rev-parse")
7
- .arg("HEAD")
8
- .output()
9
- .expect("Failed to get git commit SHA")
10
- .stdout;
11
- String::from_utf8(stdout).expect("Failed to construct string")
12
- });
+ .map(|s| s.into())
+ .unwrap_or_else(|| read_to_string(".git/refs/heads/next").unwrap_or_default());
13
14
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
15
}
0 commit comments