mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Improve error when git not installed
This commit is contained in:
parent
b189820218
commit
3bdf61e2fd
1 changed files with 8 additions and 5 deletions
|
@ -7,6 +7,8 @@ use std::io::Write;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
|
use anki_process::CommandExt;
|
||||||
|
use anyhow::Context;
|
||||||
use camino::Utf8Path;
|
use camino::Utf8Path;
|
||||||
use camino::Utf8PathBuf;
|
use camino::Utf8PathBuf;
|
||||||
use clap::Args;
|
use clap::Args;
|
||||||
|
@ -162,11 +164,12 @@ fn maybe_update_buildhash(build_root: &Utf8Path) {
|
||||||
fn get_buildhash() -> String {
|
fn get_buildhash() -> String {
|
||||||
let output = Command::new("git")
|
let output = Command::new("git")
|
||||||
.args(["rev-parse", "--short=8", "HEAD"])
|
.args(["rev-parse", "--short=8", "HEAD"])
|
||||||
.output()
|
.utf8_output()
|
||||||
.expect("git");
|
.context(
|
||||||
assert!(output.status.success(),
|
"Make sure you're building from a clone of the git repo, and that 'git' is installed.",
|
||||||
"Invoking 'git' failed. Make sure you're building from a clone of the git repo, and that 'git' is installed.");
|
)
|
||||||
String::from_utf8(output.stdout).unwrap().trim().into()
|
.unwrap();
|
||||||
|
output.stdout.trim().into()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_if_changed(path: &Utf8Path, contents: &str) {
|
fn write_if_changed(path: &Utf8Path, contents: &str) {
|
||||||
|
|
Loading…
Reference in a new issue