~wezm/annotate-rust

fe50c75cf627a6b0bf4706d44ef5b7ad84de7dc7 — Matthias Beyer 10 months ago 3584a9c
Include git stderr in error message

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
1 files changed, 4 insertions(+), 1 deletions(-)

M src/git.rs
M src/git.rs => src/git.rs +4 -1
@@ 19,9 19,12 @@ pub fn crawl_git_tree<P: AsRef<Path>>(path: P) -> io::Result<Vec<u8>> {
        .output()?;

    if !output.status.success() {
        let errstr = String::from_utf8(output.stderr)
            .unwrap_or_else(|_| String::from("<could not format git error output as UTF8>"));

        return Err(io::Error::new(
            io::ErrorKind::Other,
            "git ls-tree did not run successfully",
            format!("git ls-tree did not run successfully: {}", errstr),
        ));
    }