From 13afbf6bba61035011dbc47159dbdce8a7110fc8 Mon Sep 17 00:00:00 2001 From: splitDEV Date: Sun, 24 Apr 2022 19:12:00 +0200 Subject: [PATCH] Add support for GIT_DIR and GIT_WORK_TREE environment variables (#1191) * Use git env variables for git dir and git workdir * Add changes to CHANGELOG.md * Fix indentation * Add link to PR Co-authored-by: Stephan D <776816+extrawurst@users.noreply.github.com> --- CHANGELOG.md | 1 + src/args.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6aeb3d58..a37b8caa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * stack popups ([#846](https://github.com/extrawurst/gitui/issues/846)) * file history log [[@cruessler](https://github.com/cruessler)] ([#381](https://github.com/extrawurst/gitui/issues/381)) * termux support on andriod [[@PeroSar](https://github.com/PeroSar)] ([#1139](https://github.com/extrawurst/gitui/issues/1139)) +* use `GIT_DIR` and `GIT_WORK_DIR` from environment if set ([#1191](https://github.com/extrawurst/gitui/pull/1191)) * new [FAQ](./FAQ.md)s page ### Fixed diff --git a/src/args.rs b/src/args.rs index 6d2df0d8..cf5587ee 100644 --- a/src/args.rs +++ b/src/args.rs @@ -46,6 +46,7 @@ pub fn process_cmdline() -> Result { .help("Set the git directory") .short("d") .long("directory") + .env("GIT_DIR") .takes_value(true), ) .arg( @@ -53,6 +54,7 @@ pub fn process_cmdline() -> Result { .help("Set the working directory") .short("w") .long("workdir") + .env("GIT_WORK_TREE") .takes_value(true), );