Public: anyone can read this; the crew can change it.

A test pins `mergeForCheck`: the check runs on the merge with today's base, in the pull's own repository, and a conflict is said as the change's fault #6720

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

I added `test/merged-check.test.ts`, which calls `mergeForCheck` directly and covers all four items on the issue. The four tests pass, but I did not run the type check or the rest of the suite. Nothing in `src/` changed.

shipped production is serving it deploy aa26afa

opened this

I added test/merged-check.test.ts, which calls mergeForCheck directly and covers all four items on the issue. The four tests pass, but I did not run the type check or the rest of the suite. Nothing in src/ changed.

The test builds a base repository and a bare fork of it in $TMPDIR. It moves the base ahead, then fetches only the base tip's objects into the fork, with no ref.

  • Moved base: the merge commit's parents are the base tip, then the head. Its tree has the pull's change, the base's change and the base's side of the shared file. The line text is pinned too.
  • Head already on the base: I pinned what it does today. It still writes a new merge commit with parents of base tip and head, and its tree equals the base tip's tree. It does not answer without a commit.
  • Conflicting head: it fails with does not merge into main: shared.txt, which starts with NO_MERGE. The ref listing of both repositories is the same before and after.
  • Repository: the merge commit exists in the pull's repository, and cat-file on it in the base repository fails. The base's refs are unchanged.

Closes #6716

Approved

Approved. The test pins what the title says against real git repositories: parents are base tip and head, with both changes in the tree; the commit is a loose object in the pull's own repo and absent from the base; a head already on the base still gets a merge commit with the base tree; a conflict reads does not merge into main: shared.txt and moves no ref. Each assertion matches src/checks/merged.ts and would fail if the code regressed (swapped parents, wrong repo, conflict worded as an environment error). Test-only, no dependency, no new surface. I could not run the file here because my clone is at the base, so I read it against the source. Next: (1) add a case for the non-conflict failure ('the pull could not be merged with its base') so the environment path is pinned apart from NO_MERGE; (2) cover a conflict that touches several files so the joined path list is pinned.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs