summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2021-11-27 18:31:13 -0500
committerDan Davison <dandavison7@gmail.com>2021-11-29 08:41:24 -0500
commitb0e02830b27e7ee90a0fb820108a21546b82a1db (patch)
treee21e191a54cc7b49258313e9662be3fa3cb5f11e /src/utils
parent0f66f753d0fadec50e957a655dbdc1e3c0ad08d1 (diff)
Do not handle --word-diff or --color-words output
Fixes #440 Ref #152
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/process.rs21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/utils/process.rs b/src/utils/process.rs
index e8060cf3..63021b06 100644
--- a/src/utils/process.rs
+++ b/src/utils/process.rs
@@ -7,10 +7,14 @@ use lazy_static::lazy_static;
#[derive(Clone, Debug, PartialEq)]
pub enum CallingProcess {
+ GitDiff(CommandLine),
GitShow(CommandLine, Option<String>), // element 2 is file extension
+ GitLog(CommandLine),
+ GitReflog(CommandLine),
GitGrep(CommandLine),
OtherGrep, // rg, grep, ag, ack, etc
}
+// TODO: Git blame is currently handled differently
#[derive(Clone, Debug, PartialEq)]
pub struct CommandLine {
@@ -91,10 +95,12 @@ pub fn describe_calling_process(args: &[String]) -> ProcessArgs<CallingProcess>
match args.next() {
Some(command) => match Path::new(command).file_stem() {
Some(s) if s.to_str().map(|s| is_git_binary(s)).unwrap_or(false) => {
- let mut args = args.skip_while(|s| *s != "grep" && *s != "show");
+ let mut args = args.skip_while(|s| {
+ *s != "diff" && *s != "show" && *s != "log" && *s != "reflog" && *s != "grep"
+ });
match args.next() {
- Some("grep") => {
- ProcessArgs::Args(CallingProcess::GitGrep(parse_command_line(args)))
+ Some("diff") => {
+ ProcessArgs::Args(CallingProcess::GitDiff(parse_command_line(args)))
}
Some("show") => {
let command_line = parse_command_line(args);
@@ -110,6 +116,15 @@ pub fn describe_calling_process(args: &[String]) -> ProcessArgs<CallingProcess>
};
ProcessArgs::Args(CallingProcess::GitShow(command_line, extension))
}
+ Some("log") => {
+ ProcessArgs::Args(CallingProcess::GitLog(parse_command_line(args)))
+ }
+ Some("reflog") => {
+ ProcessArgs::Args(CallingProcess::GitReflog(parse_command_line(args)))
+ }
+ Some("grep") => {
+ ProcessArgs::Args(CallingProcess::GitGrep(parse_command_line(args)))
+ }
_ => {
// It's git, but not a subcommand that we parse. Don't
// look at any more processes.