is-unautosquashed-commit-message

1.0.1 • Public • Published

is-unautosquashed-commit-message

npm version Build Status Coverage Status

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 to squash (or fixup).

isUnautosquashedCommitMessage('Update README'); //=> false
isUnautosquashedCommitMessage('fixup! Update README'); //=> true

Installation

Use npm.

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

Package Sidebar

Install

npm i is-unautosquashed-commit-message

Weekly Downloads

2

Version

1.0.1

License

MIT-0

Unpacked Size

4.69 kB

Total Files

5

Last publish

Collaborators

  • shinnn