use std::fs::read_to_string;

fn main() {
    let git_hash = option_env!("TRAVIS_COMMIT")
        .map(|s| s.into())
        .unwrap_or_else(|| read_to_string(".git/refs/heads/next").unwrap_or_default());

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

fn main() {
    let git_hash = option_env!("TRAVIS_COMMIT")
        .map(ToOwned::to_owned)
        .unwrap_or_else(|| {
            let stdout = std::process::Command::new("git")
                .arg("rev-parse")
                .arg("HEAD")
                .output()
                .expect("Failed to get git commit SHA")
                .stdout;
            String::from_utf8(stdout).expect("Failed to construct string")
        });

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

--- 
+++ 
@@ -1,15 +1,9 @@
+use std::fs::read_to_string;
+
 fn main() {
     let git_hash = option_env!("TRAVIS_COMMIT")
-        .map(ToOwned::to_owned)
-        .unwrap_or_else(|| {
-            let stdout = std::process::Command::new("git")
-                .arg("rev-parse")
-                .arg("HEAD")
-                .output()
-                .expect("Failed to get git commit SHA")
-                .stdout;
-            String::from_utf8(stdout).expect("Failed to construct string")
-        });
+        .map(|s| s.into())
+        .unwrap_or_else(|| read_to_string(".git/refs/heads/next").unwrap_or_default());
 
     println!("cargo:rustc-env=GIT_HASH={}", git_hash);
 }
Revert "Get proper git SHA when TRAVIS_COMMIT is not available."

This reverts commit 2e3b4b774a9ff2eec46d04b48023cbfc2617ccea.
