From a9c22b704b08bee50b2431104b1c4a5cf801d526 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 31 Mar 2022 01:03:21 +0200 Subject: [PATCH] fix(cli): ignore system/user git configs So they don't interfere with straight in odd, unpredictable ways. If you *really* know what you're doing, set DOOMGITCONFIG to the path of a gitconfig file. This envvar may be renamed in the future, however. Close: #5640 Co-authored-by: M. Yas. Davoodeh --- bin/doom | 3 +++ core/cli/env.el | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/doom b/bin/doom index 9550212a4..f780d839c 100755 --- a/bin/doom +++ b/bin/doom @@ -2,6 +2,9 @@ :; set -e # -*- mode: emacs-lisp; lexical-binding: t -*- :; case "$EMACS" in *term*) EMACS=emacs ;; *) EMACS="${EMACS:-emacs}" ;; esac :; $EMACS --version >/dev/null 2>&1 || { >&2 echo "Can't find emacs in your PATH"; exit 1; } +:; unset GIT_CONFIG +:; export GIT_CONFIG_NOSYSTEM=1 +:; export GIT_CONFIG_GLOBAL="${DOOMGITCONFIG:-/dev/null}" :; $EMACS --no-site-file --script "$0" -- "$@" || __DOOMCODE=$? :; [ "${__DOOMCODE:-0}" -eq 128 ] && { sh "`$EMACS -Q --batch --eval '(princ temporary-file-directory)'`/doom.sh" "$0" "$@" && true; __DOOMCODE=$?; } :; exit $__DOOMCODE diff --git a/core/cli/env.el b/core/cli/env.el index 4451f391a..c1e8991b1 100644 --- a/core/cli/env.el +++ b/core/cli/env.el @@ -59,7 +59,7 @@ Why this over exec-path-from-shell? (defvar doom-env-blacklist '(;; State that may be problematic if overwritten "^HOME$" "^\\(OLD\\)?PWD$" "^SHLVL$" "^PS1$" "^R?PROMPT$" "^TERM\\(CAP\\)?$" - "^USER$" + "^USER$" "^GIT_CONFIG" ;; X server or services' variables that shouldn't be persisted "^DISPLAY$" "^DBUS_SESSION_BUS_ADDRESS$" "^XAUTHORITY$" "^XDG_SESSION_TYPE$" ;; Windows+WSL envvars that shouldn't be persisted