adding unstaged changes when not in "work tree" yields only ambiguous error
- Lingua principale
- Rust
- Stelle
- 22.5k
- Fork
- 773
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
**Describe the bug**
When staging changes:
```
staging all error:
git error:invalid path: 'my-path-here'; class=Index (10)
```
A git repository is created using the `--git-dir=/path/to/$FOLDER` which will create the standard `.git` contents separate from the working files. If inside this folder gitui will not complain and will incorrectly show unstaged changes and not give suitable errors.
**To Reproduce**
``` sh
mkdir -p ~/working_tree ~/git_folder && cd ~/working_tree
git init --git-dir ~/git_folder
touch readme.txt && git commit -a -c "init"
cd ~/.git_folder
git status
# fatal: this operation must be run in a work tree
# gitui > "a" to add all files > error as specified at the top
```
**Expected behavior**
A clear and concise error similar to regular git commands.
**Context (please complete the following information):**
- OS/Distro + Version: `Arch / EndeavourOS`
- GitUI Version: `nightly 2024-04-15`
- Rust version: `1.27.0`
**Additional context**
I expect many more commands to fail for similar reasons. No others tested. The porcelain git commands give a more operable error.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Reproduce the issue with a repository created using a separate --git-dir, then inspect the code handling the "a" action and the resulting Git errors. Confirm the behavior against git status and staging commands; done means repositories without a work tree produce a clear, operable error instead of the ambiguous invalid-path message.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- git, rust
- Ambito
- cli
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100