husky-elixir icon indicating copy to clipboard operation
husky-elixir copied to clipboard

Does not work with `git worktree`

Open futpib opened this issue 5 years ago • 1 comments

Try creating a second worktree for a repo:

$ worktree=$(mktemp -d)
$ git worktree add $worktree
$ cd $worktree
$ mix deps.get
$ mix husky.install

== Compilation error in file lib/husky/task/install.ex ==
** (RuntimeError) '/tmp/tmp.NJu3WB7hC2/.git' directory does not exist. Try running $ git init
    lib/husky/task/install.ex:40: Mix.Tasks.Husky.Install.create_scripts/2
    (stdlib) lists.erl:1263: :lists.foldl/3
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6

futpib avatar Aug 28 '19 12:08 futpib

@futpib thanks for opening an issue. I'll look into this.

As a work around, you might be able to set export HUSKY_SKIP_INSTALL=true to disable installing the hook scripts on compile. Just make sure that you have previously compiled deps in a more traditional git setup to install the hooks beforehand.

As a side note, I should make the install process idempotent and respect existing git hooks

spencerdcarlson avatar Aug 29 '19 02:08 spencerdcarlson