Skip to content

Commit 4d1780c

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

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Diff for: build.rs

+7-2
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-
let commit = Command::new("git")
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+
};
9+
let commit = Command::new("foobar")
510
.arg("rev-parse")
6-
.arg("--short")
11+
.arg("--short=7")
712
.arg("--verify")
813
.arg("HEAD")
914
.output();

0 commit comments

Comments
 (0)