diff options
author | Teddy Wing | 2020-08-22 21:53:56 +0200 |
---|---|---|
committer | Teddy Wing | 2020-08-22 21:53:56 +0200 |
commit | 3c6f337e26964077d1ce629fa17d16e4484b877f (patch) | |
tree | d61f1039aa25d01ff5dc354c25a0e936590e6b7b /src/bin | |
parent | 5cbc3972644a321442b9640cfcc50f7ef014a6c9 (diff) | |
download | git-suggestion-3c6f337e26964077d1ce629fa17d16e4484b877f.tar.bz2 |
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.
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/git-sugdiff.rs | 10 |
1 files changed, 9 insertions, 1 deletions
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(); }, ); } |