From 3c6f337e26964077d1ce629fa17d16e4484b877f Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 22 Aug 2020 21:53:56 +0200 Subject: Suggestion.diff_command: Return the right side version blob Don't run the `git diff` command in this function, instead return the new blob created for the right hand side of the comparison. This will facilitate showing the diffs of multiple suggestions at once. Maybe. I haven't tried the command yet. Actually, looking at the man page, it doesn't say we can include more than one blob pair, so I might need to put all of the suggestion changes into a single blob and compare the original commit with that. --- src/bin/git-sugdiff.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/bin') diff --git a/src/bin/git-sugdiff.rs b/src/bin/git-sugdiff.rs index c8ecf40..9c7ff1f 100644 --- a/src/bin/git-sugdiff.rs +++ b/src/bin/git-sugdiff.rs @@ -16,6 +16,7 @@ use std::env; use std::process; +use std::process::Command; use exitcode; @@ -42,7 +43,14 @@ fn main() { &config, |suggestion| { // TODO: Needs to work for multiple suggestions at once - suggestion.diff_command().unwrap(); + let blob = suggestion.diff_command().unwrap(); + + Command::new("git") + .arg("diff") + .arg(format!("{}:{}", suggestion.commit(), suggestion.path())) + .arg(blob.to_string()) + .spawn() + .unwrap(); }, ); } -- cgit v1.2.3