Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mookme does not work with git worktree #127

Open
conradob opened this issue Apr 25, 2024 · 0 comments · May be fixed by #128
Open

Mookme does not work with git worktree #127

conradob opened this issue Apr 25, 2024 · 0 comments · May be fixed by #128

Comments

@conradob
Copy link

As I work on multiple projects simultaneously in a single repository, I use git worktree to manage it.

This will create a new directory for each linked worktree which is linked to the current repository, sharing everything except per-worktree files such as HEAD, index, etc.

Each linked worktree also has a .git file, not a directory, which is causing this error:

$ npx mookme init --only-hook --skip-types-selection

node:fs:1398
  handleErrorFromBinding(ctx);
  ^

Error: ENOTDIR: not a directory, mkdir '/<PROJECT_PATH>/.git/hooks'
    at Object.mkdirSync (node:fs:1398:3)
    at GitToolkit.writeGitHooksFiles (/<PROJECT_PATH>/node_modules/@escape.tech/mookme/dist/utils/git.js:101:26)
    at InitRunner.run (/<PROJECT_PATH>/node_modules/@escape.tech/mookme/dist/runner/init.js:26:29)
    at async Command.<anonymous> (/<PROJECT_PATH>/node_modules/@escape.tech/mookme/dist/commands/init.js:23:9) {
  errno: -20,
  syscall: 'mkdir',
  code: 'ENOTDIR',
  path: '/<PROJECT_PATH>/.git/hooks'
}

The hooks config is in the .hooks dir and works properly when working with main working tree (regular repo checkout).

Is there a way to check if the .git is a file, and if yes, move forward and check for the .hooks?

@conradob conradob linked a pull request Apr 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant