pre-commit hook is run at the wrong time
- Lingua principale
- Rust
- Stelle
- 22.5k
- Fork
- 773
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Working on prepare-commit-msg hook (still).
prepare-commit-msg needs to run before commit message dialog is shown, this is doable . But in working on where to place that hook I find that the pre-commit hook is run at the wrong time. It should be run before the user gets to type in the commit message. This is how git cli runs it. It is annoying to type in a commit message for a commit that pre-commit is going to reject anyway
This is not easy to fix though. The way the user gets to choose to skip the validation by the 2 hooks that are allowed to veto a commit is by entering ^f in the commit dialog. Thats too late to bypass the pre-commit check if its run before the UI is shown
solutions
- dont worry about it. This would run the hooks out of order, prepare-message (which must run before the UI is shown), pre-commit, commit-msg and post-commit. And not mind about the mild user annoyance. There is also the slight possibility that running them out of the specified order creates a problem (if one depends on the other, say)
- change the mechanism for turning off validate. Maybe a different commit key (upper case C?) or maybe ^f toggle before the 'c' instead of after. This would be a breaking UI change though
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
La issue riguarda l’ordine degli hook e il flusso di attivazione e disattivazione della validazione, ma non indica file, test o punti di ingresso. Traccia innanzitutto il dialogo di commit e l’esecuzione degli hook; il lavoro sarebbe completato quando esisterà una soluzione concordata che esegua pre-commit prima dell’inserimento del messaggio senza perdere la possibilità di ignorare la validazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- git, rust
- Ambito
- cli
- Tipo di issue
- Bug
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100