MCPcopy Index your code
hub / github.com/AI45Lab/Code / normalize_git_args

Function normalize_git_args

sdk/python/src/lib.rs:6277–6303  ·  view source on GitHub ↗
(mut args: serde_json::Value)

Source from the content-addressed store, hash-verified

6275}
6276
6277fn normalize_git_args(mut args: serde_json::Value) -> PyResult<serde_json::Value> {
6278 let obj = args
6279 .as_object_mut()
6280 .ok_or_else(|| PyValueError::new_err("git options must be a dict"))?;
6281
6282 if !obj.contains_key("command") {
6283 return Err(PyValueError::new_err(
6284 "git options must include a command field",
6285 ));
6286 }
6287
6288 for (from, to) in [
6289 ("newBranch", "new_branch"),
6290 ("maxCount", "max_count"),
6291 ("includeUntracked", "include_untracked"),
6292 ] {
6293 if let Some(value) = obj.remove(from) {
6294 obj.entry(to.to_string()).or_insert(value);
6295 }
6296 }
6297
6298 if let Some(value) = obj.remove("reference") {
6299 obj.entry("ref".to_string()).or_insert(value);
6300 }
6301
6302 Ok(args)
6303}
6304
6305fn normalize_program_script_options(
6306 options: &Bound<'_, pyo3::types::PyDict>,

Callers 2

gitMethod · 0.70
git_commandMethod · 0.70

Calls 1

removeMethod · 0.80

Tested by

no test coverage detected