From 8715e8b753145b7bce3dc322b42f54900f5475ea Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sun, 12 Jan 2025 13:11:16 -0500 Subject: [PATCH] "feat(io): Panic if Git diff command fails" --- src/git_grabber.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/git_grabber.rs b/src/git_grabber.rs index fd24415..e08bbf5 100644 --- a/src/git_grabber.rs +++ b/src/git_grabber.rs @@ -1,3 +1,4 @@ +use core::panic; use std::{ fs::write, io::Write, @@ -41,7 +42,11 @@ impl GitGrabber { .output() .expect("Failed to get diff"); - let b = from_utf8(&staged_files_output.stdout).unwrap(); + if !output.status.success() { + panic!("Did you forget to stage your files?"); + } + + let b = from_utf8(&output.stdout).unwrap(); String::from(b) }