test: cover explicit git -C terminal probe

This commit is contained in:
2026-07-09 10:43:42 -04:00
parent 223cde1b94
commit f558b80cc8
3 changed files with 44 additions and 6 deletions
+10 -3
View File
@@ -380,11 +380,15 @@ def _resolve_executable(cwd: str | None, executable: str | None) -> str | None:
if not executable:
return None
if os.path.isabs(executable):
return executable if os.path.exists(executable) and os.access(executable, os.X_OK) else None
if os.path.exists(executable) and os.access(executable, os.X_OK):
return executable
return None
if "/" in executable or "\\" in executable:
target_cwd = cwd or os.getcwd()
full_path = os.path.abspath(os.path.join(target_cwd, executable))
return full_path if os.path.exists(full_path) and os.access(full_path, os.X_OK) else None
if os.path.exists(full_path) and os.access(full_path, os.X_OK):
return full_path
return None
return shutil.which(executable)
@@ -443,7 +447,10 @@ def diagnose_terminal_failure(cwd: str | None, command: list[str]) -> dict[str,
if not has_any_shell:
diagnostics["shell_exists"] = False
diagnostics["error_type"] = "missing shell"
diagnostics["error_msg"] = "No standard system shell (/bin/sh, /bin/zsh, /bin/bash) is available or executable."
diagnostics["error_msg"] = (
"No standard system shell (/bin/sh, /bin/zsh, /bin/bash) is "
"available or executable."
)
return diagnostics
return diagnostics