Skip to content

Add tests for Am configurations and threeWay override#464

Open
michelle-clayton-work wants to merge 3 commits intomainfrom
dev/mclayton/am-threeway-tests
Open

Add tests for Am configurations and threeWay override#464
michelle-clayton-work wants to merge 3 commits intomainfrom
dev/mclayton/am-threeway-tests

Conversation

@michelle-clayton-work
Copy link
Copy Markdown
Contributor

@michelle-clayton-work michelle-clayton-work marked this pull request as ready for review April 7, 2026 18:42
@michelle-clayton-work michelle-clayton-work requested a review from a team as a code owner April 7, 2026 18:42
Copilot AI review requested due to automatic review settings April 7, 2026 18:42
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

Note

Copilot was unable to run its full agentic suite in this review.

Adds regression tests to ensure patch application behavior is consistent regardless of user git am configuration, specifically am.threeWay, addressing the reported config-dependent behavior.

Changes:

  • Add a new MatchCheckRepo.CheckedApply regression test that simulates am.threeWay=true in the temp repo.
  • Add new gitcmd package tests validating Am(...) ignores am.threeWay while still applying clean patches normally.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
patch/matching_test.go Adds a parallel subtest suite verifying CheckedApply results are unchanged when am.threeWay=true is set in repo config.
gitcmd/gitcmd_test.go Introduces integration-style tests for gitcmd.Am behavior with/without am.threeWay and clean vs. context-diverged patches.

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

michelle-clayton-work and others added 2 commits April 7, 2026 12:10
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
name := filepath.Base(testDir)
t.Run(name, func(t *testing.T) {
t.Parallel()
m := tempMoremathRepo(t, filepath.Join("testdata", name, "before"))
Copy link
Copy Markdown
Member

@dagood dagood Apr 7, 2026

Choose a reason for hiding this comment

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

The inner part duplication here seems worth avoiding--a pretty flexible way to share the impl is to create a testMatchCheckRepo(t *testing.T) func and change TestMatchCheckRepo_Apply and TestMatchCheckRepo_ApplyWithThreeWayConfig to call it. Then, add testMatchCheckRepo params if necessary, like in this case a configureRepo func(r *MatchCheckRepo) that testMatchCheckRepo should call after creating the repo.

(Table-driven testing would work too. Maybe if there were a lot of configureRepo funcs to try out that would make sense.)

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