Fixes poorly made Git safe.directory workaround

This commit is contained in:
Igor Pecovnik 2024-01-26 21:25:50 +01:00 committed by Igor
parent c47c9372bf
commit 12910e0d37

View File

@ -56,9 +56,7 @@ function git_ensure_safe_directory() {
if [[ -n "$(command -v git)" ]]; then
local git_dir="$1"
display_alert "git: Marking all directories as safe, which should include" "$git_dir" "debug"
if ! grep -q "directory = \*" "${HOME}/.gitconfig" 2> /dev/null; then
git config --global --add safe.directory "*"
fi
regular_git -C "$1" config --local --get safe.directory "$1" > /dev/null || regular_git -C "$1" config --local --add safe.directory "$1"
else
display_alert "git not installed" "a true wonder how you got this far without git - it will be installed for you" "warn"
fi