Skip to content

Another step towards removing git2#13093

Merged
Byron merged 28 commits intogitbutlerapp:masterfrom
Byron:next3
Apr 6, 2026
Merged

Another step towards removing git2#13093
Byron merged 28 commits intogitbutlerapp:masterfrom
Byron:next3

Conversation

@Byron
Copy link
Copy Markdown
Collaborator

@Byron Byron commented Mar 29, 2026

With this PR, all legacy tests that depended on gitbutler-testsupport or but-testsupport::legacy
are now using primtiives directly from but-testsupport. Those already don't use Git2, but instead
rely on Git itself to setup the necessary repository state.

Follow-up to #12975

Tasks

  • refackview

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 29, 2026

@Byron is attempting to deploy a commit to the GitButler Team on Vercel.

A member of the Team first needs to authorize it.

@Byron Byron force-pushed the next3 branch 11 times, most recently from 5464186 to 9c36ed3 Compare April 5, 2026 08:01
codex and others added 6 commits April 5, 2026 17:57
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
…nfiguration file.

Use it where possible.

Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
@Byron Byron force-pushed the next3 branch 2 times, most recently from ad81ccb to c87b702 Compare April 6, 2026 05:07
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
@Byron Byron force-pushed the next3 branch 2 times, most recently from 9253224 to b93bee6 Compare April 6, 2026 06:53
codex and others added 4 commits April 6, 2026 15:08
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
codex and others added 2 commits April 6, 2026 15:34
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
codex and others added 2 commits April 6, 2026 15:34
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
codex and others added 12 commits April 6, 2026 15:56
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
This mostly copies test-helpers, which is an economical
way of dealing with this, given that the whole crate should
go away.

Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
… test-support

Instead, they embed exactly what's needed, in the hopes that it all can be removed
one day.

Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
All needed capabilities were moved into the `gitbutler-` crates respectively.

Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Mostly, this removes `autotest = false` in favor for following
the standard.

Please enter the message for your patch. Lines starting with
@Byron Byron marked this pull request as ready for review April 6, 2026 11:33
Copilot AI review requested due to automatic review settings April 6, 2026 11:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR continues the repo-wide migration away from git2 by removing the remaining but-testsupport::legacy helpers and updating production + test code to use gix-native APIs (with explicitly marked git2 “boundary” usage only where still required, e.g. checkout/index/hooks/auth adapters).

Changes:

  • Removed but-testsupport::legacy module/feature and migrated dependent tests to direct but-testsupport primitives and local test helpers.
  • Converted several APIs and call sites from git2::Oid/git2::Repository helpers to gix::ObjectId/gix::Repository equivalents.
  • Introduced lock-based Git config editing utilities (edit_repo_config / edit_config) and updated callers/tests accordingly.

Reviewed changes

Copilot reviewed 106 out of 114 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/gitbutler-workspace/src/branch_trees.rs Switch workspace tree handling to gix::ObjectId; tighten git2 boundary usage; add conflict-check helper.
crates/gitbutler-workspace/Cargo.toml Enable standard autotest discovery.
crates/gitbutler-user/tests/user/secret/users.rs Add secrets migration/roundtrip coverage using an isolated credential store.
crates/gitbutler-user/tests/user/secret/mod.rs Add secret store tests with serial execution constraints.
crates/gitbutler-user/tests/user/secret/credentials.rs Provide in-process keyring backend for deterministic tests.
crates/gitbutler-user/tests/user/main.rs New test module entrypoint.
crates/gitbutler-user/Cargo.toml Enable standard autotest discovery; remove custom test target config.
crates/gitbutler-tauri/src/projects.rs Remove eager git2 cache population during activation.
crates/gitbutler-stack/src/stack.rs Change push metadata head type to gix::ObjectId.
crates/gitbutler-stack/Cargo.toml Remove git2/but-oxidize deps and custom test target.
crates/gitbutler-repo/tests/repo/support/testing_repository.rs New local TestingRepository helper (git2 repo + gix view) for tests.
crates/gitbutler-repo/tests/repo/support/mod.rs New shared test support utilities (repos, remotes, keyring blackhole).
crates/gitbutler-repo/tests/repo/remotes.rs Add tests for add_remote behavior and errors.
crates/gitbutler-repo/tests/repo/rebase.rs Migrate rebase merge tests to gix-first merge_commits.
crates/gitbutler-repo/tests/repo/read_file_from_workspace_security.rs Migrate fixtures/helpers away from legacy testsupport.
crates/gitbutler-repo/tests/repo/managed_hooks_tests.rs Add comprehensive tests for managed hooks install/uninstall semantics.
crates/gitbutler-repo/tests/repo/main.rs Wire new test modules; remove octopus merge-base tests.
crates/gitbutler-repo/tests/repo/hooks.rs Migrate hook tests to new RepoWithOrigin support.
crates/gitbutler-repo/tests/repo/credentials.rs Update fixtures paths; use new blackhole store helper; retain git2 auth boundary coverage.
crates/gitbutler-repo/tests/repo/create_wd_tree.rs Replace legacy testing repository; update checkout usage.
crates/gitbutler-repo/tests/merge_base_octopussy.rs Removed legacy octopus merge-base tests (no longer applicable after ext removal).
crates/gitbutler-repo/src/repository_ext.rs Remove git2 extension trait; keep gix-only commit helpers.
crates/gitbutler-repo/src/remote.rs Remove From<git2::Remote> adapter; keep gix remote construction.
crates/gitbutler-repo/src/rebase.rs Make merge_commits gix-first; keep minimal git2 usage for conflict tree materialization.
crates/gitbutler-repo/src/lib.rs Stop exporting removed git2 extensions/signature helper.
crates/gitbutler-repo/src/hooks.rs Explicitly annotate remaining git2 hook/index boundaries.
crates/gitbutler-repo/src/config.rs Removed unused config wrapper.
crates/gitbutler-repo/src/commands.rs Switch add_remote to gix config editing; change commit-id API to gix::ObjectId.
crates/gitbutler-repo/Cargo.toml Enable standard autotest discovery; drop legacy testsupport feature; add keyring for tests.
crates/gitbutler-repo-actions/src/repository.rs Migrate push/distance to gix::ObjectId; remove commit helper; annotate git2 auth boundary.
crates/gitbutler-repo-actions/Cargo.toml Remove but-oxidize dependency.
crates/gitbutler-project/tests/project/support.rs New test project fixture using gix + repo-local config editing.
crates/gitbutler-project/tests/project/main.rs Migrate tests to new support; update config write flow to locked writes.
crates/gitbutler-project/tests/fixtures/repo-with-origin.sh Add fixture script for repo-with-origin scenario.
crates/gitbutler-project/tests/add_cwd_as_project.rs Use new support module for repo/data-dir setup.
crates/gitbutler-project/Cargo.toml Remove legacy testsupport feature usage.
crates/gitbutler-oplog/src/oplog.rs Move index/checkout helpers behind explicit git2 boundaries; refactor snapshot restore plumbing.
crates/gitbutler-operating-modes/tests/operating_modes.rs Replace legacy suite/case with direct fixture-based repo setup.
crates/gitbutler-operating-modes/tests/fixtures/scenario/repo-with-main.sh Add fixture for main-branch scenario.
crates/gitbutler-operating-modes/Cargo.toml Remove legacy testsupport feature usage.
crates/gitbutler-edit-mode/tests/edit_mode.rs Add explicit deprecated annotation for git2 boundary usage in test.
crates/gitbutler-edit-mode/src/lib.rs Replace git2 tree/index reconstruction with gix-native equivalents where possible.
crates/gitbutler-commit/src/commit_ext.rs Remove git2 CommitMessageBstr impl (gix-only).
crates/gitbutler-commit/Cargo.toml Drop git2 dependency.
crates/gitbutler-cherry-pick/src/repository_ext.rs Removed legacy git2 helper module.
crates/gitbutler-cherry-pick/src/lib.rs Remove git2 RepositoryExt; keep gix extension trait only.
crates/gitbutler-cherry-pick/Cargo.toml Drop git2, but-oxidize, and tracing deps.
crates/gitbutler-branch/tests/mod.rs Remove empty legacy test module file.
crates/gitbutler-branch/Cargo.toml Enable standard autotest discovery; remove custom test target.
crates/gitbutler-branch-actions/tests/fixtures/scenario/repo-with-origin.sh Add fixture script for branch-actions scenarios.
crates/gitbutler-branch-actions/tests/branch-actions/virtual_branches/workspace_migration.rs Use gix head name checks instead of git2.
crates/gitbutler-branch-actions/tests/branch-actions/virtual_branches/update_commit_message.rs Remove legacy stack_details import.
crates/gitbutler-branch-actions/tests/branch-actions/virtual_branches/undo_commit.rs Remove legacy stack_details import.
crates/gitbutler-branch-actions/tests/branch-actions/virtual_branches/unapply_without_saving_virtual_branch.rs Remove legacy stack_details import.
crates/gitbutler-branch-actions/tests/branch-actions/virtual_branches/set_base_branch.rs Remove legacy stack_details import.
crates/gitbutler-branch-actions/tests/branch-actions/virtual_branches/save_and_unapply_virtual_branch.rs Remove legacy stack_details import.
crates/gitbutler-branch-actions/tests/branch-actions/virtual_branches/oplog.rs Switch workspace commit assertions to gix; add commit summary helper.
crates/gitbutler-branch-actions/tests/branch-actions/virtual_branches/move_commit_to_vbranch.rs Use new local stack_details helper via support module.
crates/gitbutler-branch-actions/tests/branch-actions/virtual_branches/mod.rs Replace legacy TestProject with custom TestRepo + helpers; migrate data-dir handling.
crates/gitbutler-branch-actions/tests/branch-actions/virtual_branches/init.rs Replace legacy helpers; use config edit utilities.
crates/gitbutler-branch-actions/tests/branch-actions/virtual_branches/create_virtual_branch_from_branch.rs Remove legacy stack_details import.
crates/gitbutler-branch-actions/tests/branch-actions/virtual_branches/apply_virtual_branch.rs Remove legacy stack_details import.
crates/gitbutler-branch-actions/tests/branch-actions/virtual_branches/amend.rs Remove legacy stack_details import.
crates/gitbutler-branch-actions/tests/branch-actions/support.rs Add shared test support (hook_case + stack_details).
crates/gitbutler-branch-actions/tests/branch-actions/squash.rs Use new support::stack_details helper.
crates/gitbutler-branch-actions/tests/branch-actions/reorder.rs Convert tree assertions to gix; use new support::stack_details helper.
crates/gitbutler-branch-actions/tests/branch-actions/main.rs Add support module.
crates/gitbutler-branch-actions/tests/branch-actions/hooks.rs Replace legacy Suite/Case with new hook_case; annotate git2 boundary.
crates/gitbutler-branch-actions/src/stack.rs Pass gix::ObjectId through push flow.
crates/gitbutler-branch-actions/src/integration.rs Mark remaining git2 checkout/index boundary calls explicitly.
crates/gitbutler-branch-actions/src/branch_manager/branch_removal.rs Replace checkout-tree builder with direct git2 checkout call; annotate boundary.
crates/gitbutler-branch-actions/src/branch_manager/branch_creation.rs Pass uncommitted tree ids as gix::ObjectId.
crates/gitbutler-branch-actions/src/base.rs Use edit_repo_config for local config writes; update push head id type.
crates/gitbutler-branch-actions/Cargo.toml Remove legacy testsupport feature usage.
crates/but/tests/but/command/alias.rs Add assertion ensuring alias isn’t present before add.
crates/but/src/command/legacy/setup.rs Use lock-based repo-local config editing for remote setup.
crates/but/src/command/legacy/resolve.rs Use gix repo workdir for filesystem scanning.
crates/but/src/command/git_config.rs Simplify config editing to edit_repo_config with content-diff persistence.
crates/but/src/command/config.rs Update callers to new edit closure signature (Result<()>).
crates/but/src/command/alias.rs Update alias add/remove to new config-edit API; adjust remove semantics.
crates/but-worktrees/src/integrate.rs Use new conflict-check helper instead of directly materializing git2 index merges.
crates/but-worktrees/Cargo.toml Remove but-oxidize dependency.
crates/but-workspace/tests/workspace/branch/apply_unapply_commit_uncommit.rs Use repo.reload() before inspecting on-disk config mutations.
crates/but-workspace/src/legacy/tree_manipulation/split_branch.rs Use gix::ObjectId directly in references and commit walks.
crates/but-workspace/src/legacy/stacks.rs Replace git2 remote-ref existence checks with gix reference lookup.
crates/but-workspace/src/branch/apply.rs Make config editing lock-aware and persist via write_locked_config.
crates/but-workspace/Cargo.toml Remove but-oxidize dependency.
crates/but-testsupport/src/lib.rs Remove legacy module re-export.
crates/but-testsupport/src/legacy/testing_repository.rs Removed legacy testing repository helper module.
crates/but-testsupport/src/legacy/test_project.rs Removed legacy TestProject implementation.
crates/but-testsupport/src/legacy/suite.rs Removed legacy Suite/Case utilities.
crates/but-testsupport/src/legacy/secrets.rs Removed legacy keyring blackhole helper.
crates/but-testsupport/src/legacy/mod.rs Removed legacy module root and helpers.
crates/but-testsupport/Cargo.toml Remove legacy feature and its dependency surface.
crates/but-secret/tests/secret.rs Add regression test for Sensitive redaction in Debug output.
crates/but-secret/Cargo.toml Enable standard autotest discovery; remove custom test target.
crates/but-napi/src/lib.rs Remove eager git2 cache population before activation.
crates/but-ctx/src/lib.rs Mark git2_repo as deprecated boundary escape hatch; remove eager cache API.
crates/but-ctx/src/legacy.rs Allow deprecated git2 boundary cache initialization in legacy ctor.
crates/but-ctx/Cargo.toml Drop but-error dependency.
crates/but-core/tests/fixtures/scenario/git-config-empty.sh Add fixture for git-config mutation tests.
crates/but-core/tests/core/main.rs Register new git_config test module.
crates/but-core/tests/core/git_config.rs Add tests for edit_repo_config persistence behavior.
crates/but-core/src/settings.rs Persist git settings via edit_repo_config.
crates/but-core/src/repo_ext.rs Make config editing return a lock; write via write_locked_config.
crates/but-core/src/git_config.rs Implement lock-based config edit/read helpers; content-diff persistence.
crates/but-api/src/legacy/repo.rs Update commit-file API to use gix::ObjectId.
crates/but-api/src/legacy/projects.rs Add gix-based repo ownership trust check during activation.
crates/but-api/src/legacy/git.rs Switch global git config operations to edit_config/read helper.
crates/but-api/Cargo.toml Remove but-oxidize from legacy feature deps.
Cargo.lock Update dependency graph after removing legacy/tests/git2 plumbing.
AGENTS.md Add guidance to prefer repo.reload() in tests when observing on-disk changes.

Comment thread crates/gitbutler-oplog/src/oplog.rs
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: abf7905cad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/gitbutler-repo/src/commands.rs
Co-authored-by: GPT 5.4 <codex@openai.com>
@Byron Byron merged commit af87790 into gitbutlerapp:master Apr 6, 2026
40 of 41 checks passed
@Byron Byron deleted the next3 branch April 6, 2026 14:45
@Byron Byron mentioned this pull request Apr 7, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants