Skip to content

Latest commit

 

History

History
67 lines (51 loc) · 1.88 KB

File metadata and controls

67 lines (51 loc) · 1.88 KB
command pre-merge-commit
summary Install / manage a pre-merge-commit hook that runs `mdsmith fix` after a merge.

mdsmith pre-merge-commit

Manage a Git pre-merge-commit hook that runs mdsmith fix . after Git resolves every per-file merge (and the merge driver regenerates <?catalog?>/<?include?> blocks) but before the merge commit is created. Modified .md / .markdown files are re-staged automatically.

A concurrent git process can briefly hold .git/index.lock. When git add fails for that reason, the hook retries with a bounded backoff. A transient lock no longer aborts the merge. The hook never deletes a lock it did not create. If the lock outlasts the retries, the hook prints index locked and exits non-zero, so the merge stops instead of committing a partially staged tree.

mdsmith pre-merge-commit <subcommand> [args]

Subcommands

install

Install the hook at .git/hooks/pre-merge-commit, or at the path configured by core.hooksPath. The hook walks the worktree using .mdsmith.yml ignore:.

The hook's scope is a superset of the merge driver's: .gitattributes generation skips ignore: entries that can't be represented (! negation patterns, patterns with whitespace), so the hook may run mdsmith fix on files the merge driver wasn't registered for.

Explicit file lists are not accepted. Scope the hook by editing .mdsmith.yml ignore: instead.

uninstall

Remove the hook if it was installed by mdsmith. Refuses to remove user-authored hooks.

status

Show whether the hook is installed and whether the installed script matches the canonical glob-based template.

Examples

mdsmith pre-merge-commit install
mdsmith pre-merge-commit status
mdsmith pre-merge-commit uninstall

See also