Skip to content

Commit e7ba077

Browse files
codexByron
authored andcommitted
feat(gix): query the index version natively
Use the native index version for `IndexFile.version`'s managed query. Reuse the index capability guards; actual `update-index` mutations continue to use Git. The staged version passes Ruff and Python syntax checks. Its SHA-1/SHA-256 native smoke and focused pytest selection pass: 16 passed in 4.01s.
1 parent 285be26 commit e7ba077

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎git/_backend.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,13 +344,20 @@ def _ls_files(repo: Any, args: List[str], kwargs: Dict[str, Any]) -> bytes:
344344
return b"".join(output)
345345

346346

347+
def _update_index(repo: Any, args: List[str], kwargs: Dict[str, Any]) -> bytes:
348+
if args != ["--show-index-version"]:
349+
raise _Unsupported("index mutation options")
350+
return str(_index(repo, kwargs).version()).encode("ascii") + b"\n"
351+
352+
347353
_HANDLERS: Dict[str, Callable[[Any, List[str], Dict[str, Any]], bytes]] = {
348354
"rev_parse": _rev_parse,
349355
"ls_tree": _ls_tree,
350356
"symbolic_ref": _symbolic_ref,
351357
"for_each_ref": _for_each_ref,
352358
"merge_base": _merge_base,
353359
"ls_files": _ls_files,
360+
"update_index": _update_index,
354361
"config": _config,
355362
"worktree": _worktree,
356363
}

0 commit comments

Comments
 (0)