conventional-changelog-archived-repos / validate-commit-msg

DEPRECATED. Use https://github.com/marionebl/commitlint instead. githook to validate commit messages are up to standard
http://conventionalcommits.org/
MIT License
557 stars 100 forks source link

Doesn't work if package isn't in git root #116

Closed FezVrasta closed 7 years ago

FezVrasta commented 7 years ago

I see that someone already sent and merged a PR to fix this issue a while ago, but I still have this problem.

This is all I have:

"commitmsg": "validate-commit-msg",

but when I try to commit I get:

[?25h[?25hhusky > npm run -s commitmsg (node v8.1.2)

Aborting commit due to empty commit message.
fs.js:651
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open '/mytestproject/apps/web/.git/logs/incorrect-commit-msgs'
    at Object.fs.openSync (fs.js:651:18)
    at Object.fs.writeFileSync (fs.js:1300:33)
    at Object.fs.appendFileSync (fs.js:1346:6)
    at validate (/mytestproject/apps/web/node_modules/validate-commit-msg/lib/cli.js:95:10)
    at Object.<anonymous> (/mytestproject/apps/web/node_modules/validate-commit-msg/lib/cli.js:101:3)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)

Note that it refers to /mytestproject/apps/web/.git, while my git root is actually at /mytestproject

FezVrasta commented 7 years ago

Umh... not sure why but after I tried to create a symlink to the .git folder and I deleted it everything worked fine. Maybe the project was dirty somehow.