AndreasAugustin / go-gitmoji-cli

:octocat: A conventional gitmoji commit interactive command line tool for using emojis on conventional commits. :rocket:

Home Page:https://gitmoji.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: issue with hook when no message is provided

AndreasAugustin opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

☁  go-gitmoji-cli [chore/docker_test] ⚡  git commit -S                                                               
____ ____    ____ _ ___ _  _ ____  _ _    ____ _    _
| __ |  | __ | __ |  |  |\/| |  |  | | __ |    |    |
|__] |__|    |__] |  |  |  | |__| _| |    |___ |___ |
info: hooks called
info: run: [.git/COMMIT_EDITMSG merge]
info: hook commit message file .git/COMMIT_EDITMSG
fatal: issue reading and parsing the commit msg file the amount of messages is to low or to high

Expected Behavior

should not have an error

Current Behavior

does have an error

Steps To Reproduce

No response

Possible Solution

there is a check about the amount of messages provided available within the code.
This check needs to be adjusted.

Additional Information/Context

No response

go-gitmoji-cli Version

v0.2.8-alpha

Remark

Also need to check the hook commit message second message https://git-scm.com/docs/githooks

prepare-commit-msg
This hook is invoked by [git-commit[1]](https://git-scm.com/docs/git-commit) right after preparing the default log message, and before the editor is started.

It takes one to three parameters. The first is the name of the file that contains the commit log message. The second is the source of the commit message, and can be: message (if a -m or -F option was given); template (if a -t option was given or the configuration option commit.template is set); merge (if the commit is a merge or a .git/MERGE_MSG file exists); squash (if a .git/SQUASH_MSG file exists); or commit, followed by a commit object name (if a -c, -C or --amend option was given).

If the exit status is non-zero, git commit will abort.

The purpose of the hook is to edit the message file in place, and it is not suppressed by the --no-verify option. A non-zero exit means a failure of the hook and aborts the commit. It should not be used as replacement for pre-commit hook.

The sample prepare-commit-msg hook that comes with Git removes the help message found in the commented portion of the commit template.