Execute a git command with an object-shaped API. Preferred over the positional ``git(...)`` overload for new callers. Example: session.git_command({"command": "status"}) session.git_command({"command": "worktree", "subcommand": "list"})
(&self, py: Python<'_>, args: &Bound<'_, PyDict>)
| 2292 | /// session.git_command({"command": "status"}) |
| 2293 | /// session.git_command({"command": "worktree", "subcommand": "list"}) |
| 2294 | fn git_command(&self, py: Python<'_>, args: &Bound<'_, PyDict>) -> PyResult<PyToolResult> { |
| 2295 | let json_str = py_dict_to_json(args)?; |
| 2296 | let args: serde_json::Value = serde_json::from_str(&json_str) |
| 2297 | .map_err(|e| PyValueError::new_err(format!("Invalid git args: {e}")))?; |
| 2298 | let args = normalize_git_args(args)?; |
| 2299 | let session = self.inner.clone(); |
| 2300 | let result = py |
| 2301 | .allow_threads(move || get_runtime().block_on(session.tool("git", args))) |
| 2302 | .map_err(|e| PyRuntimeError::new_err(format!("git failed: {e}")))?; |
| 2303 | Ok(PyToolResult { |
| 2304 | name: result.name, |
| 2305 | output: result.output, |
| 2306 | exit_code: result.exit_code, |
| 2307 | metadata_json: result.metadata.as_ref().map(serde_json::Value::to_string), |
| 2308 | error_kind_json: result |
| 2309 | .error_kind |
| 2310 | .as_ref() |
| 2311 | .and_then(|k| serde_json::to_string(k).ok()), |
| 2312 | }) |
| 2313 | } |
| 2314 | |
| 2315 | // ======================================================================== |
| 2316 | // Advanced optional Queue API |
nothing calls this directly
no test coverage detected