Skip to main content

Module commit

Module commit 

Source
Expand description

mkit commit — build a signed commit object from the staging index.

Scope:

  1. Accept -m <msg> OR spawn $EDITOR on a tempfile pre-filled with editor::COMMIT_EDITMSG_TEMPLATE. An empty message aborts.
  2. Read .mkit/index and build a tree via worktree::build_tree_from_index. An empty / missing index is an error — mkit add <path> (or mkit add .) must come first.
  3. Resolve the author identity in this order: a. --author <spec> CLI flag (overrides everything). b. config.user_identity in .mkit/config. c. Derived from the signing key’s public key (default).
  4. Sign the commit, write the Commit object, advance refs/heads/<current> and HEAD.

Pre-issue-#102 mkit commit walked the worktree directly via worktree::build_tree, ignoring the index entirely. That made mkit add write-only state with no reader and surprised any user reasoning by analogy from git. Post-#102, the staging area is load-bearing: only paths in the index land in the commit’s tree.

Functions§

run