lintcheck: print warnings if we can't check out or clone a git repo

This commit is contained in:
Matthias Krüger 2021-02-15 22:46:58 +01:00
parent f8dbcae9f4
commit 8f1cceb6ff

View File

@ -125,20 +125,28 @@ fn download_and_extract(&self) -> Crate {
// clone the repo if we have not done so // clone the repo if we have not done so
if !repo_path.is_dir() { if !repo_path.is_dir() {
println!("Cloning {} and checking out {}", url, commit); println!("Cloning {} and checking out {}", url, commit);
Command::new("git") if !Command::new("git")
.arg("clone") .arg("clone")
.arg(url) .arg(url)
.arg(&repo_path) .arg(&repo_path)
.output() .status()
.expect("Failed to clone git repo!"); .expect("Failed to clone git repo!")
.success()
{
eprintln!("Failed to clone {} into {}", url, repo_path.display())
}
} }
// check out the commit/branch/whatever // check out the commit/branch/whatever
Command::new("git") if !Command::new("git")
.arg("checkout") .arg("checkout")
.arg(commit) .arg(commit)
.current_dir(&repo_path) .current_dir(&repo_path)
.output() .status()
.expect("Failed to check out commit"); .expect("Failed to check out commit")
.success()
{
eprintln!("Failed to checkout {} of repo at {}", commit, repo_path.display())
}
Crate { Crate {
version: commit.clone(), version: commit.clone(),