]> git.lizzy.rs Git - rust.git/commitdiff
rustbuild: Check for .git as a dir
authorAlex Crichton <alex@alexcrichton.com>
Mon, 12 Dec 2016 17:28:13 +0000 (09:28 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 12 Dec 2016 19:05:29 +0000 (11:05 -0800)
Git worktrees have this as a file and typically won't work inside docker
containers, but that's ok, so instead of just checking for existence check for a
directory to see if the git commands will succeed.

src/bootstrap/channel.rs
src/bootstrap/dist.rs

index b2341f5978704d828d10cfa0e2e8b140b33cae07..5b14b9bda6f67083d4310aa68db5383897a98ee9 100644 (file)
@@ -69,7 +69,7 @@ pub fn collect(build: &mut Build) {
 
     // If we have a git directory, add in some various SHA information of what
     // commit this compiler was compiled from.
-    if fs::metadata(build.src.join(".git")).is_ok() {
+    if build.src.join(".git").is_dir() {
         let ver_date = output(Command::new("git").current_dir(&build.src)
                                       .arg("log").arg("-1")
                                       .arg("--date=short")
index 1d3445a9eac451277c6c5853f2dd878ab5aa37fe..3abd338109065ce312278a675e124a71b52b653a 100644 (file)
@@ -18,7 +18,7 @@
 //! out to `rust-installer` still. This may one day be replaced with bits and
 //! pieces of `rustup.rs`!
 
-use std::fs::{self, File};
+use std::fs::File;
 use std::io::Write;
 use std::path::{PathBuf, Path};
 use std::process::Command;