Skip to content

Commit 5f07d3d

Browse files
committed
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.
1 parent 48bda31 commit 5f07d3d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Diff for: src/bootstrap/channel.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub fn collect(build: &mut Build) {
6969

7070
// If we have a git directory, add in some various SHA information of what
7171
// commit this compiler was compiled from.
72-
if fs::metadata(build.src.join(".git")).is_ok() {
72+
if build.src.join(".git").is_dir() {
7373
let ver_date = output(Command::new("git").current_dir(&build.src)
7474
.arg("log").arg("-1")
7575
.arg("--date=short")

Diff for: src/bootstrap/dist.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
//! out to `rust-installer` still. This may one day be replaced with bits and
1919
//! pieces of `rustup.rs`!
2020
21-
use std::fs::{self, File};
21+
use std::fs::File;
2222
use std::io::Write;
2323
use std::path::{PathBuf, Path};
2424
use std::process::Command;

0 commit comments

Comments
 (0)