Skip to content

Commit 3bb7fab

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 788f059 commit 3bb7fab

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
@@ -348,13 +348,20 @@ def _ls_files(repo: Any, args: List[str], kwargs: Dict[str, Any]) -> bytes:
348348
return b"".join(output)
349349

350350

351+
def _update_index(repo: Any, args: List[str], kwargs: Dict[str, Any]) -> bytes:
352+
if args != ["--show-index-version"]:
353+
raise _Unsupported("index mutation options")
354+
return str(_index(repo, kwargs).version()).encode("ascii") + b"\n"
355+
356+
351357
_HANDLERS: Dict[str, Callable[[Any, List[str], Dict[str, Any]], bytes]] = {
352358
"rev_parse": _rev_parse,
353359
"ls_tree": _ls_tree,
354360
"symbolic_ref": _symbolic_ref,
355361
"for_each_ref": _for_each_ref,
356362
"merge_base": _merge_base,
357363
"ls_files": _ls_files,
364+
"update_index": _update_index,
358365
"config": _config,
359366
"worktree": _worktree,
360367
}

0 commit comments

Comments
 (0)