Skip to content

Add direct library-API tests for git2_ops, gix_ops, and GitOpsManager#38

Merged
bashandbone merged 4 commits intomainfrom
copilot/add-coverage-for-git2-and-gix-ops
Mar 20, 2026
Merged

Add direct library-API tests for git2_ops, gix_ops, and GitOpsManager#38
bashandbone merged 4 commits intomainfrom
copilot/add-coverage-for-git2-and-gix-ops

Conversation

Copy link
Contributor

Copilot AI commented Mar 19, 2026

Coverage for the git ops backend layer was near zero because all existing tests route through the CLI binary. This PR adds tests/git_ops_tests.rs with 67 tests that call Git2Operations, GixOperations, and GitOpsManager directly.

Coverage added

Git2Operations

  • Constructor, workdir, read/write_gitmodules, read/write_git_config, set_config_value, list_submodules
  • Every missing-submodule error path (init, deinit, update, delete, get_status, fetch, reset, clean, stash, all sparse ops)
  • Sparse checkout enable/set/get roundtrip and get_submodule_status against a real submodule

GixOperations

  • Constructor, read/write_gitmodules (including file-creation verification), read/write_git_config (local only—global correctly fails)
  • All "not implemented" stubs (add_submodule, get_submodule_status) and all "deferred to git2" stubs (reset, clean, stash, all sparse ops)
  • Documents and asserts the known 2-part key limitation in write_git_config: keys like "user.name" split into an empty name segment and are rejected; set_config_value consequently always fails when the repo has any pre-existing local config

GitOpsManager

  • Constructor, workdir, reopen, the full gix→git2 fallback chain for config and list operations, the gix→git2→CLI triple-fallback for apply_sparse_checkout

Data types

  • SubmoduleStatusFlags bitflags (empty, single, combined, intersection) and GitConfig struct

Notes

The write_git_config / set_config_value limitation in GixOperations (3-part key requirement) is a pre-existing implementation gap—not introduced here—but is now explicitly tested and documented in the test comments.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • invalid-host
    • Triggering command: /home/REDACTED/work/submod/submod/target/debug/submod /home/REDACTED/work/submod/submod/target/debug/submod add git@invalid-host:user/repo.git --name invalid-test --path lib/invalid git add origin e/git-submodule git conf�� user.name Test User ndor/bin/git ndor/bin/git git /home/REDACTED/.lousage: $dashless $USAGE git (dns block)
    • Triggering command: /usr/bin/ssh /usr/bin/ssh -o SendEnv=GIT_PROTOCOL git@invalid-host git-upload-pack 'user/repo.git' -b main /usr/bin/git -b main nfig/composer/ve--bare git init�� /home/REDACTED/.do. (dns block)
    • Triggering command: /home/REDACTED/work/submod/submod/target/debug/submod /home/REDACTED/work/submod/submod/target/debug/submod add git@invalid-host:user/repo.git --name invalid-test --path lib/invalid p/bin/git k/submod/submod/git git /home/REDACTED/worHEAD git conf�� user.name Test User it it git t git (dns block)
  • nonexistent.domain.invalid
    • Triggering command: /home/REDACTED/work/submod/submod/target/debug/submod /home/REDACTED/work/submod/submod/target/debug/submod add REDACTED --name invalid-test --path lib/invalid ndor/bin/git --all-progress-igit --revs rgo/bin/git git conf�� user.name Test User t HEAD refs/heads/main k/_temp/ghcca-nouser.email git (dns block)
    • Triggering command: /usr/lib/git-core/git-remote-http /usr/lib/git-core/git-remote-http origin REDACTED git conf�� low test@example.com k/_temp/ghcca-node/node/bin/git (dns block)
    • Triggering command: /home/REDACTED/work/submod/submod/target/debug/submod /home/REDACTED/work/submod/submod/target/debug/submod add REDACTED --name invalid-test --path lib/invalid git /tmp/.tmp7A6JIz/git git tnet/tools/git git -C lib/new read-tree /usr/sbin/git HEAD it ndor/bin/git git (dns block)
  • nonexistent.invalid.domain.test
    • Triggering command: /home/REDACTED/work/submod/submod/target/debug/submod /home/REDACTED/work/submod/submod/target/debug/submod add REDACTED --name timeout-test --path lib/timeout it (dns block)
    • Triggering command: /usr/lib/git-core/git-remote-http /usr/lib/git-core/git-remote-http origin REDACTED (dns block)
    • Triggering command: /home/REDACTED/work/submod/submod/target/debug/submod /home/REDACTED/work/submod/submod/target/debug/submod add REDACTED --name timeout-test --path lib/timeout p/bin/git README.md git /home/REDACTED/worlib/sparse-test basename /usr�� p/bin/git git k/_temp/ghcca-node/node/bin/git -b (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

Copilot AI and others added 2 commits March 20, 2026 00:18
…Manager

Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com>
Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com>
Copilot AI changed the title [WIP] Add test coverage for git2 and gix ops modules Add direct library-API tests for git2_ops, gix_ops, and GitOpsManager Mar 20, 2026
Copilot AI requested a review from bashandbone March 20, 2026 00:23
@bashandbone bashandbone marked this pull request as ready for review March 20, 2026 00:26
Copilot AI review requested due to automatic review settings March 20, 2026 00:26
@bashandbone bashandbone added the enhancement New feature or request label Mar 20, 2026
Copy link
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

Adds direct library-API integration tests to cover the git_ops backend layer (git2_ops, gix_ops, and GitOpsManager) without routing through the CLI, improving confidence in backend behavior and fallback chains.

Changes:

  • Introduces tests/git_ops_tests.rs with broad coverage for Git2Operations, GixOperations, and GitOpsManager.
  • Adds tests for config read/write behavior and known gix key-format limitations, plus gix stub/deferred-operation behavior.
  • Adds focused tests for SubmoduleStatusFlags bitflags behavior and GitConfig struct basics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
see 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@bashandbone bashandbone merged commit 5ae0ad2 into main Mar 20, 2026
8 checks passed
@bashandbone bashandbone deleted the copilot/add-coverage-for-git2-and-gix-ops branch March 20, 2026 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants