Expand description
Base-ref selection — a faithful port of git-refs.ts.
Constants§
- EMPTY_
TREE_ REF - The well-known git empty-tree object id. Used as the diff base for a parentless (first) commit, so its full content shows up as additions.
Functions§
- base_
ref_ for_ commit_ parents - The diff base for a commit given its space-separated parent hashes:
the first parent for normal and merge commits, or the empty tree when
there are no parents. The
_hasharg is unused (parity with the original). - base_
ref_ for_ parents - The diff base for a commit given its structured parent hashes: the first
parent, or the empty tree when parentless. Prefer this over
base_ref_for_commit_parentswhen the parents are already a slice — it avoids a join/split round-trip. The string variant remains the port shim for the CLI-output path that receives space-separated parents.