From: Junio C Hamano Date: Mon, 11 Mar 2013 17:32:16 +0000 (-0700) Subject: Merge branch 'mp/complete-paths' X-Git-Tag: v1.8.2~2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f1eba9f055f59ea7a04b4bb45facc1c64abc2132?ds=inline;hp=-c Merge branch 'mp/complete-paths' * mp/complete-paths: git-completion.bash: zsh does not implement function redirection correctly --- f1eba9f055f59ea7a04b4bb45facc1c64abc2132 diff --combined contrib/completion/git-completion.bash index b62bec0279,430566d336..93eba46750 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@@ -299,9 -299,12 +299,12 @@@ __git_index_file_list_filter ( # the second argument. __git_ls_files_helper () { - # NOTE: $2 is not quoted in order to support multiple options - cd "$1" && git ls-files --exclude-standard $2 - } 2>/dev/null + ( + test -n "${CDPATH+set}" && unset CDPATH + # NOTE: $2 is not quoted in order to support multiple options + cd "$1" && git ls-files --exclude-standard $2 + ) 2>/dev/null + } # Execute git diff-index, returning paths relative to the directory @@@ -309,8 -312,11 +312,11 @@@ # specified in the second argument. __git_diff_index_helper () { - cd "$1" && git diff-index --name-only --relative "$2" - } 2>/dev/null + ( + test -n "${CDPATH+set}" && unset CDPATH + cd "$1" && git diff-index --name-only --relative "$2" + ) 2>/dev/null + } # __git_index_files accepts 1 or 2 arguments: # 1: Options to pass to ls-files (required). @@@ -510,7 -516,7 +516,7 @@@ __git_complete_revlist_file ( *) pfx="$ref:$pfx" ;; esac - __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \ + __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" 2>/dev/null \ | sed '/^100... blob /{ s,^.* ,, s,$, , @@@ -684,19 -690,10 +690,19 @@@ __git_complete_strategy ( return 1 } +__git_commands () { + if test -n "${GIT_TESTING_COMMAND_COMPLETION:-}" + then + printf "%s" "${GIT_TESTING_COMMAND_COMPLETION}" + else + git help -a|egrep '^ [a-zA-Z0-9]' + fi +} + __git_list_all_commands () { local i IFS=" "$'\n' - for i in $(git help -a|egrep '^ [a-zA-Z0-9]') + for i in $(__git_commands) do case $i in *--*) : helper pattern;; @@@ -725,7 -722,6 +731,7 @@@ __git_list_porcelain_commands ( archimport) : import;; cat-file) : plumbing;; check-attr) : plumbing;; + check-ignore) : plumbing;; check-ref-format) : plumbing;; checkout-index) : plumbing;; commit-tree) : plumbing;; @@@ -1176,13 -1172,6 +1182,13 @@@ _git_commit ( ;; esac + case "$prev" in + -c|-C) + __gitcomp_nl "$(__git_refs)" "" "${cur}" + return + ;; + esac + case "$cur" in --cleanup=*) __gitcomp "default strip verbatim whitespace @@@ -1232,8 -1221,6 +1238,8 @@@ _git_describe ( __gitcomp_nl "$(__git_refs)" } +__git_diff_algorithms="myers minimal patience histogram" + __git_diff_common_options="--stat --numstat --shortstat --summary --patch-with-stat --name-only --name-status --color --no-color --color-words --no-renames --check @@@ -1244,11 -1231,10 +1250,11 @@@ --no-ext-diff --no-prefix --src-prefix= --dst-prefix= --inter-hunk-context= - --patience + --patience --histogram --minimal --raw --dirstat --dirstat= --dirstat-by-file --dirstat-by-file= --cumulative + --diff-algorithm= " _git_diff () @@@ -1256,10 -1242,6 +1262,10 @@@ __git_has_doubledash && return case "$cur" in + --diff-algorithm=*) + __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" + return + ;; --*) __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex --base --ours --theirs --no-index @@@ -1786,7 -1768,7 +1792,7 @@@ __git_config_get_set_variables ( while [ $c -gt 1 ]; do word="${words[c]}" case "$word" in - --global|--system|--file=*) + --system|--global|--local|--file=*) config_file="$word" break ;; @@@ -1892,7 -1874,7 +1898,7 @@@ _git_config ( case "$cur" in --*) __gitcomp " - --global --system --file= + --system --global --local --file= --list --replace-all --get --get-all --get-regexp --add --unset --unset-all @@@ -2065,7 -2047,6 +2071,7 @@@ diff.suppressBlankEmpty diff.tool diff.wordRegex + diff.algorithm difftool. difftool.prompt fetch.recurseSubmodules @@@ -2339,10 -2320,6 +2345,10 @@@ _git_show ( " "" "${cur#*=}" return ;; + --diff-algorithm=*) + __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" + return + ;; --*) __gitcomp "--pretty= --format= --abbrev-commit --oneline $__git_diff_common_options @@@ -2661,7 -2638,7 +2667,7 @@@ if [[ -n ${ZSH_VERSION-} ]]; the --*=*|*.) ;; *) c="$c " ;; esac - array+=("$c") + array[$#array+1]="$c" done compset -P '*[=:]' compadd -Q -S '' -p "${2-}" -a -- array && _ret=0