about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2016-12-12 09:28:13 -0800
committerAlex Crichton <alex@alexcrichton.com>2016-12-12 11:05:29 -0800
commit5f07d3dea9717230d9c9742a3e7b9c4687c95d2e (patch)
tree68a0525a5b92ec2802021c4b67113a1c1ba34e86
parent48bda31ab92e25924449e6bebfed441f9a116e5b (diff)
rustbuild: Check for .git as a dir
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.
-rw-r--r--src/bootstrap/channel.rs2
-rw-r--r--src/bootstrap/dist.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/bootstrap/channel.rs b/src/bootstrap/channel.rs
index b2341f59787..5b14b9bda6f 100644
--- a/src/bootstrap/channel.rs
+++ b/src/bootstrap/channel.rs
@@ -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")
diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
index 1d3445a9eac..3abd3381090 100644
--- a/src/bootstrap/dist.rs
+++ b/src/bootstrap/dist.rs
@@ -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;