test: replace git CLI calls with gix library in test helpers - #364
Conversation
eab41da to
39b6aef
Compare
|
🚀 Web preview: https://preview-364.treq-9zy.pages.dev |
|
Both are timing-sensitive PTY tests in Everything else on this PR is green: Ubuntu/macOS Rust tests, JS unit/integration tests, CLI Binary, Deploy Web, and the conventional-title check. Generated by Claude Code |
…o git Repo init, config, branch creation/switching, and add+commit now go through gix (init, edit_reference, write_blob/write_object, commit). Push and the bare-remote setup calls stay on the git CLI since this gix version has no push support; JjVerifier and other assertion helpers are untouched.
Committing via gix wrote objects and moved refs but never touched .git/index, so git saw every working-tree file as untracked. Any subsequent `git checkout` (used directly in several test files, and by jj's colocated git backend) then refused to switch branches with "would be overwritten by checkout". Rebuild and write the index from the new tree after each gix commit to keep it in sync.
Git config values treat backslash as an escape character, so writing a raw Windows path (C:\Users\...\remote.git) into [remote "origin"] url produced "bad config line" and broke every with_remote() test on windows-latest. Forward slashes parse the same path fine on all platforms.
22e4d90 to
d87f3b2
Compare
Summary
Refactor the test repository helpers to use the
gixlibrary directly instead of shelling out to git CLI commands. This improves test reliability and performance by eliminating subprocess overhead and external dependencies.Key Changes
git initandgit init --barewithgix::init()andgix::init_bare()append_git_config()to directly write git config INI format instead of usinggit configCLIset_head_branch()to point HEAD at a branch via gix ref transactions (works on unborn HEAD and for branch switching)gix_create_branch_at_head()to create branches without switching to themwrite_tree_from_dir()to recursively build git tree objects from working directory contentsgix_commit_all()to stage and commit via gix, replacinggit addandgit commitCLI callsgit remote addwith direct config file writingblocking-network-clientandworktree-mutationfeatures in gix to support the new operationsNotable Implementation Details
write_tree_from_dir()function recursively builds tree objects while skipping.git,.jj, and.treqmetadata directoriesset_head_branch()function handles both unborn HEAD (before first commit) and normal branch switching scenarioshttps://claude.ai/code/session_01V1rj5DQEfaLSS3WUa8YML3