(
&self,
py: Python<'_>,
command: &Bound<'_, PyAny>,
subcommand: Option<String>,
name: Option<String>,
path: Option<String>,
new_branch: bool,
| 2206 | #[allow(clippy::too_many_arguments)] |
| 2207 | #[pyo3(signature = (command, subcommand=None, name=None, path=None, new_branch=true, base=None, force=false, max_count=None, message=None, include_untracked=false, target=None, reference=None))] |
| 2208 | fn git( |
| 2209 | &self, |
| 2210 | py: Python<'_>, |
| 2211 | command: &Bound<'_, PyAny>, |
| 2212 | subcommand: Option<String>, |
| 2213 | name: Option<String>, |
| 2214 | path: Option<String>, |
| 2215 | new_branch: bool, |
| 2216 | base: Option<String>, |
| 2217 | force: bool, |
| 2218 | max_count: Option<usize>, |
| 2219 | message: Option<String>, |
| 2220 | include_untracked: bool, |
| 2221 | target: Option<String>, |
| 2222 | reference: Option<String>, |
| 2223 | ) -> PyResult<PyToolResult> { |
| 2224 | let mut args = if let Ok(command) = command.extract::<String>() { |
| 2225 | serde_json::json!({ "command": command }) |
| 2226 | } else if let Ok(config) = command.downcast::<PyDict>() { |
| 2227 | let json_str = py_dict_to_json(config)?; |
| 2228 | let args: serde_json::Value = serde_json::from_str(&json_str) |
| 2229 | .map_err(|e| PyValueError::new_err(format!("Invalid git args: {e}")))?; |
| 2230 | normalize_git_args(args)? |
| 2231 | } else { |
| 2232 | return Err(PyTypeError::new_err( |
| 2233 | "git command must be a command string or options dict", |
| 2234 | )); |
| 2235 | }; |
| 2236 | |
| 2237 | if let Some(sc) = subcommand { |
| 2238 | args["subcommand"] = serde_json::json!(sc); |
| 2239 | } |
| 2240 | if let Some(n) = name { |
| 2241 | args["name"] = serde_json::json!(n); |
| 2242 | } |
| 2243 | if let Some(p) = path { |
| 2244 | args["path"] = serde_json::json!(p); |
| 2245 | } |
| 2246 | if !new_branch { |
| 2247 | args["new_branch"] = serde_json::json!(new_branch); |
| 2248 | } |
| 2249 | if let Some(b) = base { |
| 2250 | args["base"] = serde_json::json!(b); |
| 2251 | } |
| 2252 | if force { |
| 2253 | args["force"] = serde_json::json!(force); |
| 2254 | } |
| 2255 | if let Some(mc) = max_count { |
| 2256 | args["max_count"] = serde_json::json!(mc); |
| 2257 | } |
| 2258 | if let Some(msg) = message { |
| 2259 | args["message"] = serde_json::json!(msg); |
| 2260 | } |
| 2261 | if include_untracked { |
| 2262 | args["include_untracked"] = serde_json::json!(include_untracked); |
| 2263 | } |
| 2264 | if let Some(t) = target { |
| 2265 | args["target"] = serde_json::json!(t); |
nothing calls this directly
no test coverage detected