Skip to content

Draft a message for each conflict's authors - #19

Draft
chris-peterson wants to merge 1 commit into
mainfrom
message-the-author-on-conflict
Draft

chris-peterson wants to merge 1 commit into
mainfrom
message-the-author-on-conflict

Conversation

@chris-peterson

@chris-peterson chris-peterson commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Context

When git fi can't merge, it names the conflicting branch and its author, then prints commands for whoever ran it. The fix belongs to the branch owners, so the failure output now gives the person who ran it a ready-to-paste message for each conflict's authors: the branch, <project>@fi, the first conflicting hunk (diff3, so the merge base sits between the two sides), and what to do. The -r line stays, introduced as the way to get fi building again while those messages go out.

Review guide

Critical path

  • src/readiness.ts — who gets messaged per conflict kind; your own branch gets the steps with no message
  • src/readiness.ts — hunk read from the failed probe's tree, no checkout; control bytes stripped
  • src/readiness.ts — a branch several failures collide with leads

Integration points

  • src/git.ts — name and email share the listing's last field, split at the first <
  • src/merge.ts — keeps --json to its existing shape

Ancillary

@chris-peterson chris-peterson self-assigned this Sep 22, 2026
@chris-peterson chris-peterson added the enhancement New feature or request label Sep 22, 2026
@chris-peterson chris-peterson added this to the 1.4 milestone Sep 22, 2026
@chris-peterson
chris-peterson force-pushed the message-the-author-on-conflict branch 2 times, most recently from b0a5309 to 653c7ad Compare September 23, 2026 00:23
A failed merge named the conflicting branch and its author's email, then
offered commands, so whoever ran git fi was left to work the fix out on
the authors' behalf, or to take the branch out with -r and move on. The
authors of the conflicting branches are the ones who can resolve it, so the output
now gives the reader something to send them: the branch, where it
failed to merge (<project>@fi, from the origin URL), the first
conflicting hunk, and what to do.

The hunk comes from the tree the failed merge-tree probe already wrote,
which carries git's conflict markers, so reading it needs no checkout.
Probes run with merge.conflictStyle=diff3 so the merge base sits between
the two sides. Its lines are a file's bytes printed to a terminal, so
control characters are stripped, as they are for author emails.

- A conflict with main ends with the fix as three steps. The rebase
  stops at the conflict for someone to resolve, so the push is its own
  step rather than the end of one chain that reads as automatic. The
  steps also pull first, which the old one-liner skipped, leaving it to
  rebase onto a stale origin/main.
- A conflict between two peers is the failing branch author's to fix.
  Keeping a branch mergeable into main is its author's job with or
  without fi, and fi merges in insertion order, so the branch that
  failed is the later arrival. The message goes to its author and
  names the peer's author to talk to about how the two changes should
  fit together. Where the failing branch is the reader's own, it
  becomes a heads-up to the peer's author instead.
- A branch of the reader's own gets the steps without a message.
- A branch several failures collide with leads, with those failures
  grouped: one conversation with its author clears all of them.
- The -r line, set off by a rule and coloured as a command to run, is
  introduced as the way to get fi building again now,
  alongside sending the messages.

Author names come from the same git branch -r listing as the email:
both share its last field, split at the first "<", which git's ident
parser never lets into a name. Each --json conflict carries the same
author as an object ({name, email}, null where git reported none), so
a CI job can notify the author who can fix it.
@chris-peterson
chris-peterson force-pushed the message-the-author-on-conflict branch from 653c7ad to 1126674 Compare September 23, 2026 00:50

This branch has not been deployed

No deployments
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.

1 participant