Skip to content

Refactor git graph tests to use real repositories - #14349

Merged
BagToad merged 1 commit into
williammartin-git-real-repo-test-harnessfrom
williammartin-git-graph-tests
Oct 30, 2026
Merged

BagToad merged 1 commit into
williammartin-git-real-repo-test-harnessfrom
williammartin-git-graph-tests

Conversation

@williammartin

@williammartin williammartin commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

Description

Follow on from #14348

The graph, branch configuration and worktree tests still supply Git output through helper-process scripts. That checks the expected command, but not whether the operation produces the intended repository state.

This PR replaces those scripts with local repository scenarios using the shared harness. The assertions cover commit selection, push destinations, branch and tag operations, repository paths and worktree state.

How did you test this change?

Not tested manually. This changes automated scenarios without changing production code.

Key points

The repository scenarios use real Git, but tests for malformed output still supply their own input. Those error cases cannot be reliably produced by creating a normal repository.

Notes for reviewers

Start with commit selection, push resolution and unmerged-branch deletion, then read the configuration and worktree conversions.

This builds on the harness in #14348. The local transport scenarios follow in #14350.

Authorship and follow-up

Who wrote this:

  • A human wrote it.
  • An agent wrote it under close human direction.
  • An agent wrote it independently, and no human has guided the implementation beyond the initial prompt.

Who answers review comments:

  • @williammartin will read and reply directly. Name the account.
  • An agent will draft replies and @username will read them before they are posted.
  • Nobody has explicitly committed to replying.

@williammartin
williammartin force-pushed the williammartin-git-graph-tests branch from 4e10fe3 to 091f872 Compare September 4, 2026 15:17
Copilot AI balanced review requested due to automatic review settings October 29, 2026 10:21
@williammartin
williammartin force-pushed the williammartin-git-graph-tests branch from d8cd13b to 55a5841 Compare October 29, 2026 10:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The unsupported cherry-pick --quiet option causes the test to fail before its assertions, and the branch-deletion test no longer verifies forced deletion of an unmerged branch.

2 open issues
What changed in this PR

Builds on the repository harness from #14348 to replace more Git client subprocess mocks with real local repositories. The changes focus on testing repository behavior without altering production code.

Changes:

  • Converts graph, ref, configuration, branch, tag, checkout, path, and worktree tests to repository-state and error assertions.
  • Adds scenarios for divergent history, signed commits, and worktree lifecycle operations while retaining malformed-output fixtures.
  • Resolves temporary-directory symlinks for consistent path comparisons.
File Description
git/​client_test.go Replaces mock-based tests with local repository scenarios and normalizes harness paths.

Review effort: Balanced

Comment thread git/client_test.go Resolved
Comment thread git/client_test.go Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The filesystem error check uses a nonfatal assertion contrary to the testing guide, allowing subsequent worktree assertions to run after an unexpected result.

1 open issue
2 resolved since last review

Review effort: Balanced

Comment thread git/client_test.go Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified in the test-only change expanding Git client coverage against real local repositories.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@williammartin
williammartin force-pushed the williammartin-git-graph-tests branch from 91c9056 to ebb46da Compare October 29, 2026 20:33
@williammartin
williammartin marked this pull request as ready for review October 29, 2026 20:44
@williammartin
williammartin requested a review from a team as a code owner October 29, 2026 20:44
@BagToad BagToad mentioned this pull request Oct 30, 2026
2 of 6 tasks
@BagToad
BagToad merged commit 443baeb into trunk Oct 30, 2026
18 checks passed
@BagToad
BagToad deleted the williammartin-git-graph-tests branch October 30, 2026 17:30
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.

3 participants