From: Junio C Hamano Date: Mon, 14 May 2012 18:50:57 +0000 (-0700) Subject: Merge branch 'fc/simplify-complete-revlist-file' X-Git-Tag: v1.7.11-rc0~30 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/fca9249b86411718a66835fe5107219b49c1767f?hp=-c Merge branch 'fc/simplify-complete-revlist-file' By Felipe Contreras * fc/simplify-complete-revlist-file: completion: simplify __git_complete_revlist_file --- fca9249b86411718a66835fe5107219b49c1767f diff --combined contrib/completion/git-completion.bash index 9f56ec7a6b,d877a2315c..2f60825b21 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@@ -304,16 -304,16 +304,16 @@@ __git_ps1 ( fi } -# __gitcomp_1 requires 2 arguments __gitcomp_1 () { - local c IFS=' '$'\t'$'\n' + local c IFS=$' \t\n' for c in $1; do - case "$c$2" in - --*=*) printf %s$'\n' "$c$2" ;; - *.) printf %s$'\n' "$c$2" ;; - *) printf %s$'\n' "$c$2 " ;; + c="$c$2" + case $c in + --*=*|*.) ;; + *) c="$c " ;; esac + printf '%s\n' "$c" done } @@@ -676,9 -676,7 +676,7 @@@ __git_complete_revlist_file ( *) pfx="$ref:$pfx" ;; esac - local IFS=$'\n' - COMPREPLY=($(compgen -P "$pfx" \ - -W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \ + __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \ | sed '/^100... blob /{ s,^.* ,, s,$, , @@@ -692,7 -690,7 +690,7 @@@ s,$,/, } s/^.* //')" \ - -- "$cur_")) + "$pfx" "$cur_" "" ;; *...*) pfx="${cur_%...*}..." @@@ -1658,7 -1656,7 +1656,7 @@@ _git_notes ( __gitcomp '--ref' ;; ,*) - case "${words[cword-1]}" in + case "$prev" in --ref) __gitcomp_nl "$(__git_refs)" ;; @@@ -1684,7 -1682,7 +1682,7 @@@ prune,*) ;; *) - case "${words[cword-1]}" in + case "$prev" in -m|-F) ;; *) @@@ -2623,9 -2621,8 +2621,9 @@@ _git ( case "$i" in --git-dir=*) __git_dir="${i#--git-dir=}" ;; --bare) __git_dir="." ;; - --version|-p|--paginate) ;; --help) command="help"; break ;; + -c) c=$((++c)) ;; + -*) ;; *) command="$i"; break ;; esac ((c++)) @@@ -2640,12 -2637,9 +2638,12 @@@ --bare --version --exec-path + --exec-path= --html-path + --info-path --work-tree= --namespace= + --no-replace-objects --help " ;;