Skip to main content

Module merge

Module merge 

Source
Expand description

In-memory candidate merge composition (epic #1427, issue #1428).

CandidateComposer is a pure-library wrapper over git2::Repository::merge_trees that produces detached merge candidates — trees and commits materialised into the object database without ever moving HEAD or touching the working tree. This is the M1 building block for deterministic sequential candidate composition (M1, M1+2, …): each merge_trees step is a pure function of three trees, so the same inputs always yield the same tree OID.

§Scope

This module deliberately stops at candidate materialisation. It does not:

  • perform network clone/fetch (B4’s job),
  • talk to any forge API (B4),
  • dispatch workflows (#989),
  • decide merge authority, or
  • land/merge a candidate onto a branch.

§Design note — detached commits

The issue spec names commit_create_buffer, but that primitive yields a commit content buffer (for signing flows) rather than a CommitOid. The return contract here is a real, addressable CommitOid, so we use git2::Repository::commit with update_ref = None, which writes the commit into the object database without updating any ref and without moving HEAD — satisfying the “detached commit does not move HEAD” acceptance criterion directly.

Structs§

Candidate
A detached candidate commit + its tree, produced by CandidateComposer::compose_candidate.
CandidateComposer
In-memory, HEAD-preserving merge composition.
ConflictEntry
A single conflicted path entry captured from git2::Index::conflicts.
ConflictReport
Structured capture of merge conflicts from an in-memory merge_trees.
MergeTreesResult
Result of an in-memory three-way tree merge.

Enums§

ConflictSide
Which side of a three-way merge a conflicted path belongs to.