|
11 | 11 | use std::{
|
12 | 12 | collections::BTreeMap,
|
13 | 13 | env,
|
14 |
| - ffi::OsString, |
| 14 | + ffi::{OsStr, OsString}, |
15 | 15 | io::Read,
|
16 | 16 | path::{Path, PathBuf},
|
17 | 17 | str::FromStr,
|
@@ -589,11 +589,15 @@ const NULL_DEVICE: &str = "NUL";
|
589 | 589 | #[cfg(not(windows))]
|
590 | 590 | const NULL_DEVICE: &str = "/dev/null";
|
591 | 591 |
|
592 |
| -fn configure_command<'a>( |
| 592 | +fn configure_command<'a, I, S>( |
593 | 593 | cmd: &'a mut std::process::Command,
|
594 |
| - args: &[String], |
| 594 | + args: I, |
595 | 595 | script_result_directory: &Path,
|
596 |
| -) -> &'a mut std::process::Command { |
| 596 | +) -> &'a mut std::process::Command |
| 597 | +where |
| 598 | + I: IntoIterator<Item = S>, |
| 599 | + S: AsRef<OsStr>, |
| 600 | +{ |
597 | 601 | let mut msys_for_git_bash_on_windows = env::var_os("MSYS").unwrap_or_default();
|
598 | 602 | msys_for_git_bash_on_windows.push(" winsymlinks:nativestrict");
|
599 | 603 | cmd.args(args)
|
@@ -925,10 +929,9 @@ mod tests {
|
925 | 929 | populate_ad_hoc_config_files(temp.path());
|
926 | 930 |
|
927 | 931 | let mut cmd = std::process::Command::new("git");
|
928 |
| - let args = ["config", "-l", "--show-origin"].map(String::from); |
929 | 932 | cmd.env("GIT_CONFIG_SYSTEM", SCOPE_ENV_VALUE);
|
930 | 933 | cmd.env("GIT_CONFIG_GLOBAL", SCOPE_ENV_VALUE);
|
931 |
| - configure_command(&mut cmd, &args, temp.path()); |
| 934 | + configure_command(&mut cmd, ["config", "-l", "--show-origin"], temp.path()); |
932 | 935 |
|
933 | 936 | let output = cmd.output().expect("can run git");
|
934 | 937 | let lines: Vec<_> = output
|
|
0 commit comments