Use a timeout when doing a git merge in the prompt command.

This commit is contained in:
Darren 'Tadgy' Austin 2024-08-23 23:47:01 +01:00
commit 5adad9a874

View file

@ -177,7 +177,7 @@ __git_prompt_command() {
[[ "${GIT_REPO_INFO[0]}" == "true" ]] && { [[ "${GIT_REPO_INFO[0]}" == "true" ]] && {
# Run prefetch tasks if not disabled. # Run prefetch tasks if not disabled.
[[ -z "$GIT_DISABLE_PROMPT_PREFETCH" ]] && [[ "$(git config --local --get --type bool script.DisablePromptPrefetch 2>/dev/null)" != "true" ]] && { [[ -z "$GIT_DISABLE_PROMPT_PREFETCH" ]] && [[ "$(git config --local --get --type bool script.DisablePromptPrefetch 2>/dev/null)" != "true" ]] && {
git maintenance run --task=prefetch 2>/dev/null || { timeout --signal=KILL 7s git maintenance run --task=prefetch 2>/dev/null || {
printf "\\033[1;31m%s\\033[0m\\n" "Git maintenance 'prefetch' task failed." >&2 printf "\\033[1;31m%s\\033[0m\\n" "Git maintenance 'prefetch' task failed." >&2
return 1 return 1
} }