Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow fixing (editing) invalid commit message interactively
Before, in interactive mode, an invalid commit message would have resulted in the user being asked: Continue anyway? [yes/no] Now there's also the option of editing the message: Continue anyway? [yes/no/edit] Also, now if the user gives an invalid reply i.e. types 'ues' the script won't exit immediately but prints an error message and waits for another response. The option of editing the commit message is given only if the input (i.e. the commit message) is passed in as a regular file. This is always the case when lint-commit-msg is used in commit-msg hook. Even if the user runs git commit -m "..." the commit message is written into a temporary file that is passed to commit-msg hook (and then to lint-commit-msg). So, in which case the user is prevented from selecting 'edit'? When the commit message is fed into lint-commit-msg via stdin. However, this can only happen when lint-commit-msg is run standalone... and in that case the interactive mode is not used... unless LCM_INTERACTIVE is set to 'always'. So, that's the corner case when the user should not be able to edit the commit message. Other possibility is a file without 'write' permission LCM_INTERACTIVE=always lint-commit-msg not-writable-file.txt in which case trying to edit the file would be pointless.
- Loading branch information