feat: shell snapshotting (#7641)

This commit is contained in:
jif-oai
2025-12-09 18:36:58 +00:00
committed by GitHub
parent ac3237721e
commit 7836aeddae
14 changed files with 807 additions and 48 deletions

View File

@@ -112,7 +112,7 @@ fn classify_shell_name(shell: &str) -> Option<String> {
fn classify_shell(shell: &str, flag: &str) -> Option<ApplyPatchShell> {
classify_shell_name(shell).and_then(|name| match name.as_str() {
"bash" | "zsh" | "sh" if flag == "-lc" => Some(ApplyPatchShell::Unix),
"bash" | "zsh" | "sh" if matches!(flag, "-lc" | "-c") => Some(ApplyPatchShell::Unix),
"pwsh" | "powershell" if flag.eq_ignore_ascii_case("-command") => {
Some(ApplyPatchShell::PowerShell)
}
@@ -1097,6 +1097,13 @@ mod tests {
assert_match(&heredoc_script(""), None);
}
#[test]
fn test_heredoc_non_login_shell() {
let script = heredoc_script("");
let args = strs_to_strings(&["bash", "-c", &script]);
assert_match_args(args, None);
}
#[test]
fn test_heredoc_applypatch() {
let args = strs_to_strings(&[