-
-
Notifications
You must be signed in to change notification settings - Fork 800
Don't set $GIT_DIR and alike
Jonas Bernoulli edited this page Mar 25, 2022
·
1 revision
Setting environment variables like $GIT_DIR
and $GIT_WORK_TREE
for an
emacs
instance is a recipe for disaster.
The problem is that environment variables are shared across all of
Emacs, so every buffer shares the same value. The equivalent outside
outside of Emacs would be if doing export VAR=VAL
in one terminal
would take effect all other current and future terminals.
This means that certain command-line tools such as vcsh don’t work properly in combination with Emacs/Magit. See #2939.
Unfortunately git commit
does export $GIT_DIR
before calling $EDITOR
,
leading to issues such as #3516, so Magit now unsets that variable and
$GIT_WORK_TREE
if they are set when magit
is loaded.