armbian-next: git: backport safe.directory method from master (just add *, once) -- thanks Igor

This commit is contained in:
Ricardo Pardini 2023-02-02 13:10:49 +01:00
parent 3236f76a6a
commit da02fde9cc
No known key found for this signature in database
GPG Key ID: 3D38CA12A66C5D02

View File

@ -47,8 +47,10 @@ function improved_git_fetch() {
function git_ensure_safe_directory() {
if [[ -n "$(command -v git)" ]]; then
local git_dir="$1"
display_alert "git: Marking directory as safe" "$git_dir" "debug"
run_host_command_logged git config --global --add safe.directory "$git_dir"
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
else
display_alert "git not installed" "a true wonder how you got this far without git - it will be installed for you" "warn"
fi