merge

package
v0.3.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package merge resolves concurrent edits to a ticket field by field.

Git merges text line by line, which is wrong for this format in a specific and common way: when two people move the same ticket, both sides rewrite the same `status:` line and git reports a conflict on the single most frequent operation the whole system performs. Union-merging the file instead would produce two `status:` lines — invalid YAML rather than a resolved value.

So the merge is structural. Lists union, `status` resolves by how far along the lane sequence each side got, other scalars resolve by recency, and only a genuine overlap in prose is escalated to a human — scoped to the field that actually conflicts rather than the whole ticket.

The trade-off worth naming: this is the one place jaira does something non-obvious to a repository, since git has to be told the driver exists. That registration is visible rather than silent, and it buys the property the whole storage model depends on.

Index

Constants

View Source
const FieldConflicts = "merge-conflicts"

FieldConflicts names the frontmatter key listing fields left unresolved.

Variables

This section is empty.

Functions

func RenderConflicts

func RenderConflicts(cs []Conflict) string

RenderConflicts describes what a human needs to resolve, scoped to the fields that actually clashed rather than dumping the whole file.

Types

type Conflict

type Conflict struct {
	Field  string
	Ours   string
	Theirs string
	Base   string
}

Conflict describes one unresolvable field.

type Result

type Result struct {
	// Merged is the resulting file content.
	Merged []byte
	// Conflicts is empty on a clean merge.
	Conflicts []Conflict
	// Notes explains automatic resolutions, for the caller to log.
	Notes []string
}

Result is the outcome of a merge.

func Merge

func Merge(base, ours, theirs []byte, lanes *lane.Set) (*Result, error)

Merge performs a three-way merge of one ticket file.

ours is used as the structural base for the output so its formatting, comments and key order survive; only resolved values are spliced in.

func (*Result) Clean

func (r *Result) Clean() bool

Clean reports whether the merge needs no human attention.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL