AnswerDotAI / AnswerDotAI/nbdev

Support git worktree in `nbdev_install_hooks`

Open
#1,246 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
5.3k
Forks
513
Avg merge
2d 30m
Merged PRs (30d)
8

Description

When running `nbdev_install_hooks`, I get

```
NotADirectoryError: [Errno 20] Not a directory: '/dir1/.git/hooks'
```
This makes sense, because I'm using git's worktrees:

```
% cat .git
gitdir: /dir2/.git/worktrees/dir1
```

If I understand correctly, the issue is [here](https://github.com/fastai/nbdev/blob/master/nbdev/clean.py#L195-L199), where the code assumes that the `.git` directory is `$(git rev-parse --show-toplevel)/.git`; instead, it should ask `git` directly via `git rev-parse --git-dir`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.