Skip to content

Commit ead877a

Browse files
author
Junfeng Li
committed
Revert "Get proper git SHA when TRAVIS_COMMIT is not available."
This reverts commit 2e3b4b7.
1 parent 3be2b5c commit ead877a

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

build.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1+
use std::fs::read_to_string;
2+
13
fn main() {
24
let git_hash = option_env!("TRAVIS_COMMIT")
3-
.map(ToOwned::to_owned)
4-
.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-
});
5+
.map(|s| s.into())
6+
.unwrap_or_else(|| read_to_string(".git/refs/heads/next").unwrap_or_default());
137

148
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
159
}

0 commit comments

Comments
 (0)