From 588cd526fd78b3a0e0ec1dfb9fc194ca385de902 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 23 Aug 2020 17:41:37 +0200 Subject: Suggestion.diff_command: Diff an index instead of a file This will enable us to use the `git diff` command with more than one suggestion at the same time. We compare the commit of the suggestion with the new index's tree. And as I write this, I'm realising that we can't diff multiple suggestions using the same commit because each suggestion has its own commit. Need to work out a different way to do this. --- src/bin/git-sugdiff.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/bin/git-sugdiff.rs') diff --git a/src/bin/git-sugdiff.rs b/src/bin/git-sugdiff.rs index 9c7ff1f..362eb15 100644 --- a/src/bin/git-sugdiff.rs +++ b/src/bin/git-sugdiff.rs @@ -43,12 +43,12 @@ fn main() { &config, |suggestion| { // TODO: Needs to work for multiple suggestions at once - let blob = suggestion.diff_command().unwrap(); + let tree = suggestion.diff_command().unwrap(); Command::new("git") .arg("diff") - .arg(format!("{}:{}", suggestion.commit(), suggestion.path())) - .arg(blob.to_string()) + .arg(suggestion.commit()) + .arg(tree.to_string()) .spawn() .unwrap(); }, -- cgit v1.2.3