Skip to content

Commit 2b33bdc

Browse files
committed
[Task 5] Fix lefthook.yml to preserve user commit messages
Implements: - Updated prepare-commit-msg hook to check {2} parameter - Hook only runs commitment when {2} is empty (regular commits) - Preserves messages for git commit -m and merge commits - Updated hook to use commands instead of jobs for consistency - Added explanatory comments matching example hooks Acceptance criteria met: ✅ lefthook.yml checks {2} parameter before running commitment ✅ git commit generates message (hook runs) ✅ git commit -m "test" preserves message (hook skips) ✅ Merge commits preserve messages (hook skips) ✅ commitment dogfooding still works ✅ Examples already correct (no changes needed)
1 parent 6b081db commit 2b33bdc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lefthook.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ prepare-commit-msg:
1414
skip:
1515
- merge
1616
- rebase
17-
jobs:
18-
- run: ./dist/cli.js --message-only > {1}
17+
commands:
18+
commitment:
19+
# Only run for regular commits (not merge, squash, or when message specified)
20+
# {1} is the commit message file, {2} is the commit source
21+
run: '[ -z "{2}" ] && ./dist/cli.js --message-only > {1} || true'
1922
interactive: true

0 commit comments

Comments
 (0)