carloscuesta / gitmoji-cli

A gitmoji interactive cli tool for using emojis on commits. 💻
https://www.npmjs.com/package/gitmoji-cli
MIT License
4.59k stars 206 forks source link

Can't commit after updating to 3.2.14 #509

Closed MalteHei closed 3 years ago

MalteHei commented 3 years ago

Hello @carloscuesta!

After updating to the latest version, the git commit hook fails.

Reproduce:

npm i -g gitmoji-cli@3.2.14
touch abc && git add abc
git commit

Downgrading to 3.2.13 "solves" this.

OS: Arch Linux (WSL) gitmoji -v: 3.2.14 Node version: 15.3.0

Error Message:

TypeError: Cannot read property 'startsWith' of undefined
    at /home/hei/.npm-global/lib/node_modules/gitmoji-cli/lib/commands/commit/withHook/index.js:61:27
    at new Promise (<anonymous>)
    at cancelIfAmending (/home/hei/.npm-global/lib/node_modules/gitmoji-cli/lib/commands/commit/withHook/index.js:53:32)
    at cancelIfNeeded (/home/hei/.npm-global/lib/node_modules/gitmoji-cli/lib/commands/commit/withHook/index.js:71:30)
    at Object.commit (/home/hei/.npm-global/lib/node_modules/gitmoji-cli/lib/commands/commit/index.js:27:41)
    at Object.hook (/home/hei/.npm-global/lib/node_modules/gitmoji-cli/lib/cli.js:82:33)
    at findGitmojiCommand (/home/hei/.npm-global/lib/node_modules/gitmoji-cli/lib/utils/findGitmojiCommand.js:11:73)
    at Object.<anonymous> (/home/hei/.npm-global/lib/node_modules/gitmoji-cli/lib/cli.js:90:33)
    at Module._compile (node:internal/modules/cjs/loader:1102:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
carloscuesta commented 3 years ago

Hey @MalteHei thanks for opening an issue,

That's probably related with https://github.com/carloscuesta/gitmoji-cli/pull/507

I'm going to revert it now and publish a new update

cc @Jeremie-Chauvel

Seems that

Screenshot 2020-12-09 at 17 40 48

This could be undefined and not a string, so the commit hook is failing there, can you take a look with me ?

carloscuesta commented 3 years ago

Already released 3.2.15 with the revert, we are going to fix that later!

Thanks!

Jeremie-Chauvel commented 3 years ago

Maybe git version ? I will write a fix.