fix completion

This commit is contained in:
fatalerrors
2026-05-06 18:20:30 +02:00
parent 9698f0e506
commit a91c41871a

View File

@@ -58,9 +58,26 @@ _profile_git_complete_refs()
_profile_git_complete_add_paths()
{
# shellcheck disable=SC2034 # Used indirectly by git-completion helpers via dynamic scope.
local cur words cword prev
local complete_opt="--others --modified --directory --no-empty-directory"
if declare -F __git_complete_index_file >/dev/null 2>&1; then
if declare -F _get_comp_words_by_ref >/dev/null 2>&1; then
_get_comp_words_by_ref -n =: cur words cword prev
else
cur="${COMP_WORDS[COMP_CWORD]}"
if (( COMP_CWORD > 0 )); then
prev="${COMP_WORDS[COMP_CWORD-1]}"
else
prev=""
fi
# shellcheck disable=SC2034 # Used indirectly by git-completion helpers via dynamic scope.
cword="$COMP_CWORD"
# shellcheck disable=SC2034 # Used indirectly by git-completion helpers via dynamic scope.
words=("${COMP_WORDS[@]}")
fi
if [[ -n $(__git_find_on_cmdline "-u --update") ]]; then
complete_opt="--modified"
fi