It's more true to what it is.
Unified · Split
| @@ -7,22 +7,22 @@ use std::process::{Command, Stdio}; · 6 unmodified lines | ||
| 7 | 7 | /// The kind of helper program to use. |
| 8 | 8 | #[derive(Debug, Clone, Eq, PartialEq)] |
| 9 | 9 | pub enum Kind { |
| 10 | − /// The built-in `git credential` helper program, part of any git distribution. | |
| 10 | + /// The built-in `git credential` helper program, part of any `git` distribution. | |
| 11 | 11 | Builtin, |
| 12 | 12 | /// A custom credentials helper, as identified just by the name with optional arguments |
| 13 | − CustomName { | |
| 13 | + ExternalName { | |
| 14 | 14 | /// The name like `foo` along with optional args, like `foo --arg --bar="a b"`, with arguments using `sh` shell quoting rules. |
| 15 | 15 | /// The program executed will be `git-credential-foo` if `name_and_args` starts with `foo`. |
| 16 | 16 | name_and_args: BString, |
| 17 | 17 | }, |
| 18 | 18 | /// A custom credentials helper, as identified just by the absolute path to the program and optional arguments. The program is executed through a shell. |
| 19 | − CustomPath { | |
| 19 | + ExternalPath { | |
| 20 | 20 | /// The absolute path to the executable, like `/path/to/exe` along with optional args, like `/path/to/exe --arg --bar="a b"`, with arguments using `sh` |
| 21 | 21 | /// shell quoting rules. |
| 22 | 22 | path_and_args: BString, |
| 23 | 23 | }, |
| 24 | 24 | /// A script to execute with `sh`. |
| 25 | − CustomScript(BString), | |
| 25 | + ExternalShellScript(BString), | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | impl Program { |
| @@ -37,7 +37,7 @@ impl Program { · 8 unmodified lines | ||
| 37 | 37 | let mut input = input.into(); |
| 38 | 38 | Program::Ready(if input.starts_with(b"!") { |
| 39 | 39 | input.remove(0); |
| 40 | − Kind::CustomScript(input) | |
| 40 | + Kind::ExternalShellScript(input) | |
| 41 | 41 | } else { |
| 42 | 42 | let path = git_path::from_bstr( |
| 43 | 43 | input |
| @@ -46,10 +46,10 @@ impl Program { · 2 unmodified lines | ||
| 46 | 46 | .as_bstr(), |
| 47 | 47 | ); |
| 48 | 48 | if git_path::is_absolute(path) { |
| 49 | − Kind::CustomPath { path_and_args: input } | |
| 49 | + Kind::ExternalPath { path_and_args: input } | |
| 50 | 50 | } else { |
| 51 | 51 | input.insert_str(0, "git credential-"); |
| 52 | − Kind::CustomName { name_and_args: input } | |
| 52 | + Kind::ExternalName { name_and_args: input } | |
| 53 | 53 | } |
| 54 | 54 | }) |
| 55 | 55 | } |
| @@ -71,11 +71,11 @@ impl Helper for Program { · 15 unmodified lines | ||
| 71 | 71 | .arg(action.as_helper_arg(false)); |
| 72 | 72 | cmd |
| 73 | 73 | } |
| 74 | − Kind::CustomScript(for_shell) | |
| 75 | − | Kind::CustomName { | |
| 74 | + Kind::ExternalShellScript(for_shell) | |
| 75 | + | Kind::ExternalName { | |
| 76 | 76 | name_and_args: for_shell, |
| 77 | 77 | } |
| 78 | − | Kind::CustomPath { | |
| 78 | + | Kind::ExternalPath { | |
| 79 | 79 | path_and_args: for_shell, |
| 80 | 80 | } => git_command::prepare(git_path::from_bstr(for_shell.as_bstr()).as_ref()) |
| 81 | 81 | .with_shell() |
| @@ -117,7 +117,7 @@ mod program { · 116 unmodified lines | ||
| 117 | 117 | helper.insert_str(0, "sh "); |
| 118 | 118 | assert_eq!( |
| 119 | 119 | git_credentials::helper::invoke( |
| 120 | − Program::Ready(Kind::CustomScript(helper)), | |
| 120 | + Program::Ready(Kind::ExternalShellScript(helper)), | |
| 121 | 121 | &invoke::Action::get_for_url("/does/not/matter"), |
| 122 | 122 | )? |
| 123 | 123 | .expect("present") |
| @@ -5,7 +5,7 @@ mod from_custom_definition { · 4 unmodified lines | ||
| 5 | 5 | #[test] |
| 6 | 6 | fn script() { |
| 7 | 7 | assert!( |
| 8 | − matches!(Program::from_custom_definition("!exe"), Program::Ready(Kind::CustomScript(script)) if script == "exe") | |
| 8 | + matches!(Program::from_custom_definition("!exe"), Program::Ready(Kind::ExternalShellScript(script)) if script == "exe") | |
| 9 | 9 | ); |
| 10 | 10 | } |
| 11 | 11 | |
| @@ -14,7 +14,7 @@ mod from_custom_definition { · 2 unmodified lines | ||
| 14 | 14 | let input = "name --arg --bar=\"a b\""; |
| 15 | 15 | let expected = "git credential-name --arg --bar=\"a b\""; |
| 16 | 16 | assert!( |
| 17 | − matches!(Program::from_custom_definition(input), Program::Ready(Kind::CustomName{name_and_args}) if name_and_args == expected) | |
| 17 | + matches!(Program::from_custom_definition(input), Program::Ready(Kind::ExternalName{name_and_args}) if name_and_args == expected) | |
| 18 | 18 | ); |
| 19 | 19 | } |
| 20 | 20 | |
| @@ -23,7 +23,7 @@ mod from_custom_definition { · 2 unmodified lines | ||
| 23 | 23 | let input = "name"; |
| 24 | 24 | let expected = "git credential-name"; |
| 25 | 25 | assert!( |
| 26 | − matches!(Program::from_custom_definition(input), Program::Ready(Kind::CustomName{name_and_args}) if name_and_args == expected) | |
| 26 | + matches!(Program::from_custom_definition(input), Program::Ready(Kind::ExternalName{name_and_args}) if name_and_args == expected) | |
| 27 | 27 | ); |
| 28 | 28 | } |
| 29 | 29 | |
| @@ -31,7 +31,7 @@ mod from_custom_definition { · 1 unmodified line | ||
| 31 | 31 | fn path_with_args() { |
| 32 | 32 | let input = "/abs/name --arg --bar=\"a b\""; |
| 33 | 33 | assert!( |
| 34 | − matches!(Program::from_custom_definition(input), Program::Ready(Kind::CustomPath{path_and_args}) if path_and_args == input) | |
| 34 | + matches!(Program::from_custom_definition(input), Program::Ready(Kind::ExternalPath{path_and_args}) if path_and_args == input) | |
| 35 | 35 | ); |
| 36 | 36 | } |
| 37 | 37 | |
| @@ -39,7 +39,7 @@ mod from_custom_definition { · 1 unmodified line | ||
| 39 | 39 | fn path() { |
| 40 | 40 | let input = "/abs/name"; |
| 41 | 41 | assert!( |
| 42 | − matches!(Program::from_custom_definition(input), Program::Ready(Kind::CustomPath{path_and_args}) if path_and_args == input) | |
| 42 | + matches!(Program::from_custom_definition(input), Program::Ready(Kind::ExternalPath{path_and_args}) if path_and_args == input) | |
| 43 | 43 | ); |
| 44 | 44 | } |
| 45 | 45 | } |