I'm a bit a bit stumped by an annoying problem that I'm having with magit. I'm working in a monorepo (lerna) repository that uses husky to run a precommit hook. The hook runs on packages that have changed within the monorepo. When I try to commit using magit, I get an abort message:
1 git … commit -- starting precommit yarn run v1.22.5 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. husky - pre-commit hook exited with code 1 (error) However, if I run a commit command at the command line, there's no abort. I've been trying to debug this but am quite stumped. Why would the behavior change within magit if magit just runs a commit command. Is magit doing something else on top of this? Is there a general incompatibility of some sort with husky or hooks?
Has anyone experienced something similar or have any ideas about how to get better insight into what's going on?
One of the reasons it has been hard to debug is that magit also seems to swallow the output of the precommit script itself, which if I run at the command line I can see. So I know that the linting tests for example are not producing any errors that might causes an exit code designed to abort the commit.
magit-shell-commandand was eventually able to spot an error related to an environment variable that is set in my.zshrcbut not in the emacs environment. So it's nos just a matter of finding the right way to set that variable for emacs.