Skip to content

Commit cfc2ae9

Browse files
committed
Allow builds from 'git archive' generated tarballs
1 parent d6ab753 commit cfc2ae9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

build.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
fn get_git_hash() -> String {
22
use std::process::Command;
33

4+
// Allow builds from `git archive` generated tarballs if output of `git get-tar-commit-id` is
5+
// set in an env var.
6+
if let Ok(commit) = std::env::var("TAR_COMMIT_ID") {
7+
return commit[..7].to_string();
8+
};
49
let commit = Command::new("git")
510
.arg("rev-parse")
6-
.arg("--short")
11+
.arg("--short=7")
712
.arg("--verify")
813
.arg("HEAD")
914
.output();

0 commit comments

Comments
 (0)