is-unautosquashed-commit-message
v1.0.1
Published
Check if the value is a commit message that'll be melded into another by `git -i --autosquash`
Downloads
7
Maintainers
Readme
is-unautosquashed-commit-message
Check if a given value is a message of Git commit that'll be melded into another by git -i --autosquash
:
When the commit log message begins with "squash! …" (or "fixup! …"), and there is a commit whose title begins with the same …, automatically modify the todo list of rebase -i so that the commit marked for squashing comes right after the commit to be modified, and change the action of the moved commit from
pick
tosquash
(orfixup
).
isUnautosquashedCommitMessage('Update README'); //=> false
isUnautosquashedCommitMessage('fixup! Update README'); //=> true
Installation
npm install is-unautosquashed-commit-message
API
import isUnautosquashedCommitMessage from 'is-unautosquashed-commit-message';
isUnautosquashedCommitMessage(message)
message: any type (but always return false
when non-string value is passed)
Return: boolean
// Returns `true`
isUnautosquashedCommitMessage('fixup! add index.js');
isUnautosquashedCommitMessage('squash! use Set\n\ninstead of Array');
isUnautosquashedCommitMessage(' fixup! bump version');
isUnautosquashedCommitMessage('\tsquash!\n🔧');
// Returns `false`
isUnautosquashedCommitMessage('add index.js');
isUnautosquashedCommitMessage('fixup!add index.js');
isUnautosquashedCommitMessage('squash!');
isUnautosquashedCommitMessage('fixup! ');
isUnautosquashedCommitMessage(['this', 'is', 'a', 'non-string', 'value']);
isUnautosquashedCommitMessage();
License
MIT No Attribution © 2019 Shinnosuke Watanabe