AnswerDotAI / AnswerDotAI/nbdev

Support git worktree in `nbdev_install_hooks`

Aperta
#1,246 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Jupyter Notebook
Stelle
5.3k
Fork
513
Merge medio
2g 30m
PR unite (30g)
8

Descrizione

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`.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia in nbdev/clean.py alle righe 195-199 e verifica come nbdev_install_hooks individua la directory Git. Esegui il comando in un Git worktree, usa git rev-parse --git-dir come suggerito dall’issue e conferma che l’installazione dell’hook non sollevi più NotADirectoryError.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
git, python
Ambito
tooling
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.