Respect git environment variables when committing
- Vorherrschende Sprache
- Rust
- Sterne
- 22.5k
- Forks
- 773
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
**Describe the bug**
According to https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables git uses environment variables as primary source for name and email configuration.
> The final creation of a Git commit object is usually done by git-commit-tree, which uses these environment variables as its primary source of information, falling back to configuration values only if these aren’t present.
**To Reproduce**
Steps to reproduce the behavior:
1. Set:
```
export GIT_COMMITTER_NAME="Your Name"
export GIT_AUTHOR_EMAIL="git@example.com"
export GIT_COMMITTER_EMAIL="git@example.com"
export GIT_AUTHOR_NAME=Your Name"
export EMAIL="git@example.com"
```
2. Commit something with `git commit`
3. See in the logs that the env var values were used
4. Commit something with gitui
5. See in the logs that the git configured user was used instead.
**Expected behavior**
As git docs explains, environment variables should be used as primary source for the git commit command. If the variables are not configured we fall back to git configuration values.
**Screenshots**
Not applicable
**Context (please complete the following information):**
- OS/Distro + Version: Ubuntu 20.04.5
- GitUI Version: gitui 0.22.1
- Rust version: No idea, I use the package from the Nix package manager
**Additional context**
Even though it's suboptimal it's quite common that humans share users on certain machines, when working with Git it's nice to be able to send GIT_* and EMAIL over SSH to Git and gitui 😄
Workaround: Stage with gitui, commit with git (Same workaround as signing commits).
Beitragsleitfaden
Rechercherichtung
Beginne beim gitui-Commit-Einstiegspunkt und verfolge, wie die Werte für die Identität des Autors und des Committers für `git commit` ausgewählt werden. Vergleiche diese Auswahl mit den Git-Variablen GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL und EMAIL und reproduziere anschließend das gemeldete Verhalten zwischen Umgebung und Konfiguration, um das Ergebnis zu verifizieren.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- git, rust
- Bereich
- cli
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100