completion: simplify by using $prev
authorFelipe Contreras <felipe.contreras@gmail.com>
Sun, 15 Apr 2012 19:44:17 +0000 (22:44 +0300)
committerJunio C Hamano <gitster@pobox.com>
Sun, 22 Apr 2012 05:39:06 +0000 (22:39 -0700)
cword-1 is the previous word ($prev).

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash

index db2d3cc3fde3490eeb8724ce56b77babce235f14..8c91faf1af966236d3389be2ff0638647e405e7e 100755 (executable)
@@ -1658,7 +1658,7 @@ _git_notes ()
                __gitcomp '--ref'
                ;;
        ,*)
-               case "${words[cword-1]}" in
+               case "$prev" in
                --ref)
                        __gitcomp_nl "$(__git_refs)"
                        ;;
@@ -1684,7 +1684,7 @@ _git_notes ()
        prune,*)
                ;;
        *)
-               case "${words[cword-1]}" in
+               case "$prev" in
                -m|-F)
                        ;;
                *)