History

change!: rename `Program::Custom*` variants to `Program::External*` (#450)

It's more true to what it is.

Sebastian Thiel committed 4 years ago

Commit bfa25451 parent 6565b973 files · +16 −16Browse files

Unified · Split

3 files
  1. git-credentials/src/program.rs +10 −10
  2. git-credentials/tests/helper/invoke.rs +1 −1
  3. git-credentials/tests/program/mod.rs +5 −5
git-credentials/src/program.rs+10−10
@@ -7,22 +7,22 @@ use std::process::{Command, Stdio}; · 6 unmodified lines
77 /// The kind of helper program to use.
88 #[derive(Debug, Clone, Eq, PartialEq)]
99 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.
1111 Builtin,
1212 /// A custom credentials helper, as identified just by the name with optional arguments
13− CustomName {
13+ ExternalName {
1414 /// The name like `foo` along with optional args, like `foo --arg --bar="a b"`, with arguments using `sh` shell quoting rules.
1515 /// The program executed will be `git-credential-foo` if `name_and_args` starts with `foo`.
1616 name_and_args: BString,
1717 },
1818 /// 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 {
2020 /// 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`
2121 /// shell quoting rules.
2222 path_and_args: BString,
2323 },
2424 /// A script to execute with `sh`.
25− CustomScript(BString),
25+ ExternalShellScript(BString),
2626 }
2727
2828 impl Program {
@@ -37,7 +37,7 @@ impl Program { · 8 unmodified lines
3737 let mut input = input.into();
3838 Program::Ready(if input.starts_with(b"!") {
3939 input.remove(0);
40− Kind::CustomScript(input)
40+ Kind::ExternalShellScript(input)
4141 } else {
4242 let path = git_path::from_bstr(
4343 input
@@ -46,10 +46,10 @@ impl Program { · 2 unmodified lines
4646 .as_bstr(),
4747 );
4848 if git_path::is_absolute(path) {
49− Kind::CustomPath { path_and_args: input }
49+ Kind::ExternalPath { path_and_args: input }
5050 } else {
5151 input.insert_str(0, "git credential-");
52− Kind::CustomName { name_and_args: input }
52+ Kind::ExternalName { name_and_args: input }
5353 }
5454 })
5555 }
@@ -71,11 +71,11 @@ impl Helper for Program { · 15 unmodified lines
7171 .arg(action.as_helper_arg(false));
7272 cmd
7373 }
74− Kind::CustomScript(for_shell)
75− | Kind::CustomName {
74+ Kind::ExternalShellScript(for_shell)
75+ | Kind::ExternalName {
7676 name_and_args: for_shell,
7777 }
78− | Kind::CustomPath {
78+ | Kind::ExternalPath {
7979 path_and_args: for_shell,
8080 } => git_command::prepare(git_path::from_bstr(for_shell.as_bstr()).as_ref())
8181 .with_shell()
git-credentials/tests/helper/invoke.rs+1−1
@@ -117,7 +117,7 @@ mod program { · 116 unmodified lines
117117 helper.insert_str(0, "sh ");
118118 assert_eq!(
119119 git_credentials::helper::invoke(
120− Program::Ready(Kind::CustomScript(helper)),
120+ Program::Ready(Kind::ExternalShellScript(helper)),
121121 &invoke::Action::get_for_url("/does/not/matter"),
122122 )?
123123 .expect("present")
git-credentials/tests/program/mod.rs+5−5
@@ -5,7 +5,7 @@ mod from_custom_definition { · 4 unmodified lines
55 #[test]
66 fn script() {
77 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")
99 );
1010 }
1111
@@ -14,7 +14,7 @@ mod from_custom_definition { · 2 unmodified lines
1414 let input = "name --arg --bar=\"a b\"";
1515 let expected = "git credential-name --arg --bar=\"a b\"";
1616 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)
1818 );
1919 }
2020
@@ -23,7 +23,7 @@ mod from_custom_definition { · 2 unmodified lines
2323 let input = "name";
2424 let expected = "git credential-name";
2525 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)
2727 );
2828 }
2929
@@ -31,7 +31,7 @@ mod from_custom_definition { · 1 unmodified line
3131 fn path_with_args() {
3232 let input = "/abs/name --arg --bar=\"a b\"";
3333 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)
3535 );
3636 }
3737
@@ -39,7 +39,7 @@ mod from_custom_definition { · 1 unmodified line
3939 fn path() {
4040 let input = "/abs/name";
4141 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)
4343 );
4444 }
4545 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t