Skip to content

Commit

Permalink
fix!: rename Prepare::with_shell_allow_argument_splitting() to `Pre…
Browse files Browse the repository at this point in the history
…pare::with_shell_allow_manual_argument_splitting()`
  • Loading branch information
Byron committed Dec 16, 2024
1 parent 26c274d commit 4d9bded
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gix-command/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ mod prepare {
/// Use a shell, but try to split arguments by hand if this can be safely done without a shell.
///
/// If that's not the case, use a shell instead.
pub fn with_shell_allow_argument_splitting(mut self) -> Self {
pub fn with_shell_allow_manual_argument_splitting(mut self) -> Self {
self.allow_manual_arg_splitting = true;
self.with_shell()
}
Expand Down
12 changes: 7 additions & 5 deletions gix-command/tests/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ mod prepare {
#[test]
fn multiple_arguments_in_one_line_with_auto_split() {
let cmd = std::process::Command::from(
gix_command::prepare("echo first second third").with_shell_allow_argument_splitting(),
gix_command::prepare("echo first second third").with_shell_allow_manual_argument_splitting(),
);
assert_eq!(
format!("{cmd:?}"),
Expand Down Expand Up @@ -313,8 +313,9 @@ mod prepare {

#[test]
fn single_and_complex_arguments_with_auto_split() {
let cmd =
std::process::Command::from(gix_command::prepare("ls --foo=\"a b\"").with_shell_allow_argument_splitting());
let cmd = std::process::Command::from(
gix_command::prepare("ls --foo=\"a b\"").with_shell_allow_manual_argument_splitting(),
);
assert_eq!(
format!("{cmd:?}"),
format!(r#""ls" "--foo=a b""#),
Expand All @@ -332,8 +333,9 @@ mod prepare {

#[test]
fn single_and_complex_arguments_will_not_auto_split_on_special_characters() {
let cmd =
std::process::Command::from(gix_command::prepare("ls --foo=~/path").with_shell_allow_argument_splitting());
let cmd = std::process::Command::from(
gix_command::prepare("ls --foo=~/path").with_shell_allow_manual_argument_splitting(),
);
assert_eq!(
format!("{cmd:?}"),
format!(r#""{SH}" "-c" "ls --foo=~/path" "--""#),
Expand Down

0 comments on commit 4d9bded

Please sign in to comment.