Add additonal check before running git command
This commit is contained in:
parent
12910e0d37
commit
6b42f34b73
@ -55,8 +55,10 @@ function improved_git_fetch() {
|
||||
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"
|
||||
regular_git -C "$1" config --local --get safe.directory "$1" > /dev/null || regular_git -C "$1" config --local --add safe.directory "$1"
|
||||
if regular_git -C "$1" -C rev-parse --git-dir > /dev/null 2>&1; then
|
||||
display_alert "git: Marking all directories as safe, which should include" "$git_dir" "debug"
|
||||
regular_git -C "$1" config --local --get safe.directory "$1" > /dev/null || regular_git -C "$1" config --local --add safe.directory "$1"
|
||||
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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user