Skip to content

Commit a7d813e

Browse files
codexByron
authored andcommitted
feat(gix): query merged repository configuration natively
Serve simple managed `config --get` requests from the native configuration snapshot, including implicit booleans and missing-key status. Open configuration queries without synthetic safety settings so they report the user's actual values. Files, streams, enumeration and mutations stay on Git (GIX-12). The staged version passes Ruff and Python syntax checks. Its SHA-1/SHA-256 native smoke and focused pytest selection pass: 23 passed in 1.11s.
1 parent 7a1af24 commit a7d813e

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎git/_backend.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,24 @@ def _for_each_ref(repo: Any, args: List[str], kwargs: Dict[str, Any]) -> bytes:
194194
)
195195

196196

197+
def _config(repo: Any, args: List[str], kwargs: Dict[str, Any]) -> bytes:
198+
if len(args) == 2 and args[0] == "--get":
199+
snapshot = repo.config_snapshot()
200+
value = snapshot.string(args[1])
201+
if value is None:
202+
if snapshot.boolean(args[1]) is None:
203+
raise GitCommandError(["git", "config"], 1)
204+
value = b"" # An implicit boolean is an empty value in --get output.
205+
return value + b"\n"
206+
raise _Unsupported("config file parsing, enumeration, or mutation (GIX-12)")
207+
208+
197209
_HANDLERS: Dict[str, Callable[[Any, List[str], Dict[str, Any]], bytes]] = {
198210
"rev_parse": _rev_parse,
199211
"ls_tree": _ls_tree,
200212
"symbolic_ref": _symbolic_ref,
201213
"for_each_ref": _for_each_ref,
214+
"config": _config,
202215
}
203216

204217

0 commit comments

Comments
 (0)