| @@ -7,22 +7,22 @@ use std::process::{Command, Stdio}; · 6 unmodified lines |
| 7 | /// The kind of helper program to use. | 7 | /// The kind of helper program to use. |
| 8 | #[derive(Debug, Clone, Eq, PartialEq)] | 8 | #[derive(Debug, Clone, Eq, PartialEq)] |
| 9 | pub enum Kind { | 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 | Builtin, | 11 | Builtin, |
| 12 | /// A custom credentials helper, as identified just by the name with optional arguments | 12 | /// A custom credentials helper, as identified just by the name with optional arguments |
| 13 | CustomName { | 13 | ExternalName { |
| 14 | /// The name like `foo` along with optional args, like `foo --arg --bar="a b"`, with arguments using `sh` shell quoting rules. | 14 | /// The name like `foo` along with optional args, like `foo --arg --bar="a b"`, with arguments using `sh` shell quoting rules. |
| 15 | /// The program executed will be `git-credential-foo` if `name_and_args` starts with `foo`. | 15 | /// The program executed will be `git-credential-foo` if `name_and_args` starts with `foo`. |
| 16 | name_and_args: BString, | 16 | name_and_args: BString, |
| 17 | }, | 17 | }, |
| 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. | 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 | /// 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` | 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 | /// shell quoting rules. | 21 | /// shell quoting rules. |
| 22 | path_and_args: BString, | 22 | path_and_args: BString, |
| 23 | }, | 23 | }, |
| 24 | /// A script to execute with `sh`. | 24 | /// A script to execute with `sh`. |
| 25 | CustomScript(BString), | 25 | ExternalShellScript(BString), |
| 26 | } | 26 | } |
| 27 | | 27 | |
| 28 | impl Program { | 28 | impl Program { |
| @@ -37,7 +37,7 @@ impl Program { · 8 unmodified lines |
| 37 | let mut input = input.into(); | 37 | let mut input = input.into(); |
| 38 | Program::Ready(if input.starts_with(b"!") { | 38 | Program::Ready(if input.starts_with(b"!") { |
| 39 | input.remove(0); | 39 | input.remove(0); |
| 40 | Kind::CustomScript(input) | 40 | Kind::ExternalShellScript(input) |
| 41 | } else { | 41 | } else { |
| 42 | let path = git_path::from_bstr( | 42 | let path = git_path::from_bstr( |
| 43 | input | 43 | input |
| @@ -46,10 +46,10 @@ impl Program { · 2 unmodified lines |
| 46 | .as_bstr(), | 46 | .as_bstr(), |
| 47 | ); | 47 | ); |
| 48 | if git_path::is_absolute(path) { | 48 | if git_path::is_absolute(path) { |
| 49 | Kind::CustomPath { path_and_args: input } | 49 | Kind::ExternalPath { path_and_args: input } |
| 50 | } else { | 50 | } else { |
| 51 | input.insert_str(0, "git credential-"); | 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 | .arg(action.as_helper_arg(false)); | 71 | .arg(action.as_helper_arg(false)); |
| 72 | cmd | 72 | cmd |
| 73 | } | 73 | } |
| 74 | Kind::CustomScript(for_shell) | 74 | Kind::ExternalShellScript(for_shell) |
| 75 | | Kind::CustomName { | 75 | | Kind::ExternalName { |
| 76 | name_and_args: for_shell, | 76 | name_and_args: for_shell, |
| 77 | } | 77 | } |
| 78 | | Kind::CustomPath { | 78 | | Kind::ExternalPath { |
| 79 | path_and_args: for_shell, | 79 | path_and_args: for_shell, |
| 80 | } => git_command::prepare(git_path::from_bstr(for_shell.as_bstr()).as_ref()) | 80 | } => git_command::prepare(git_path::from_bstr(for_shell.as_bstr()).as_ref()) |
| 81 | .with_shell() | 81 | .with_shell() |