Use a script. prefix for git config to disable prefetch.

This commit is contained in:
Darren 'Tadgy' Austin 2023-10-25 14:41:57 +01:00
commit 8f7cbd8986

View file

@ -16,7 +16,7 @@ __prompt_git_status() {
# GIT_PROMPT_SHOW_UPSTREAM_EXTENDED=1 In addition to upstream status, show the number of commits difference (inplies above).
# GIT_PROMPT_AUTO_PREFETCH=1 Automatically 'prefetch' upstream refs for comparisons (requires GIT_PROMPT_SHOW_UPSTREAM above).
# This can be disabled on a per repository basis using:
# git config --add --bool maintenance.promptprefetchdisabled true
# git config --add --local --bool script.PromptPrefetchDisabled true
# GIT_PROMPT_SHOW_IGNORED=1 Show a ! if the current directory is ignored.
# GIT_PROMPT_SHOW_UNSTAGED=1 Show a * if there are unstaged changes (superceeded by above).
# GIT_PROMPT_SHOW_UNCOMMITTED=1 Show a & if there are staged but uncommitted changes (superceeded by above).
@ -66,7 +66,7 @@ __prompt_git_status() {
# Add upstream status.
[[ -n "$GIT_PROMPT_SHOW_UPSTREAM" ]] || [[ -n "$GIT_PROMPT_SHOW_UPSTREAM_EXTENDED" ]] && {
# Whether to run prefetch tasks.
[[ -n "$GIT_PROMPT_AUTO_PREFETCH" ]] && [[ "$(git config --get --bool maintenance.promptprefetchdisabled 2>/dev/null)" != "true" ]] && {
[[ -n "$GIT_PROMPT_AUTO_PREFETCH" ]] && [[ "$(git config --get --local --bool script.PromptPrefetchDisabled 2>/dev/null)" != "true" ]] && {
git maintenance run --task=prefetch 2>/dev/null || printf "\\033[1;31m%s\\033[39m\\n" "Git maintenance 'prefetch' task failed." >&2
}
COUNT="$(git rev-list --count --left-right "${BRANCH:+refs/prefetch/remotes/origin/}${BRANCH:-@{upstream\}}...HEAD" 2>/dev/null | tr '[:blank:]' ' ')"