From: Junio C Hamano Date: Mon, 13 Jan 2014 19:33:38 +0000 (-0800) Subject: Merge branch 'rr/completion-format-coverletter' X-Git-Tag: v1.9-rc0~13 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/ca46578a1d6ee3f6e27eafa7902fd4e62d58db7d?ds=inline;hp=-c Merge branch 'rr/completion-format-coverletter' The bash/zsh completion code did not know about format.coverLetter among many format.* configuration variables. * rr/completion-format-coverletter: completion: complete format.coverLetter --- ca46578a1d6ee3f6e27eafa7902fd4e62d58db7d diff --combined contrib/completion/git-completion.bash index 4fe5ce31bd,39b81f7a68..8aaf214b7d --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@@ -178,9 -178,9 +178,9 @@@ _get_comp_words_by_ref ( } fi -__gitcompadd () +__gitcompappend () { - local i=0 + local i=${#COMPREPLY[@]} for x in $1; do if [[ "$x" == "$3"* ]]; then COMPREPLY[i++]="$2$x$4" @@@ -188,12 -188,6 +188,12 @@@ done } +__gitcompadd () +{ + COMPREPLY=() + __gitcompappend "$@" +} + # Generates completion reply, appending a space to possible completion words, # if necessary. # It accepts 1 to 4 arguments: @@@ -224,14 -218,6 +224,14 @@@ __gitcomp ( esac } +# Variation of __gitcomp_nl () that appends to the existing list of +# completion candidates, COMPREPLY. +__gitcomp_nl_append () +{ + local IFS=$'\n' + __gitcompappend "$1" "${2-}" "${3-$cur}" "${4- }" +} + # Generates completion reply from newline-separated possible completion words # by appending a space to all of them. # It accepts 1 to 4 arguments: @@@ -243,8 -229,8 +243,8 @@@ # appended. __gitcomp_nl () { - local IFS=$'\n' - __gitcompadd "$1" "${2-}" "${3-$cur}" "${4- }" + COMPREPLY=() + __gitcomp_nl_append "$@" } # Generates completion reply with compgen from newline-separated possible @@@ -1841,7 -1827,6 +1841,7 @@@ _git_config ( branch.*) local pfx="${cur%.*}." cur_="${cur#*.}" __gitcomp_nl "$(__git_heads)" "$pfx" "$cur_" "." + __gitcomp_nl_append $'autosetupmerge\nautosetuprebase\n' "$pfx" "$cur_" return ;; guitool.*.*) @@@ -1884,7 -1869,6 +1884,7 @@@ remote.*) local pfx="${cur%.*}." cur_="${cur#*.}" __gitcomp_nl "$(__git_remotes)" "$pfx" "$cur_" "." + __gitcomp_nl_append "pushdefault" "$pfx" "$cur_" return ;; url.*.*) @@@ -2007,6 -1991,7 +2007,7 @@@ fetch.unpackLimit format.attach format.cc + format.coverLetter format.headers format.numbered format.pretty