index 79b414bab42235a82d249e49ba24de6c52ed3b7f..402e1cfc2538595f4f0d4b590b5c8b601cfbb5bd 100755 (executable)
##
# bash completion support for tig
#
-# Copyright (C) 2007 Jonas fonseca
+# Copyright (C) 2007-2010 Jonas fonseca
# Copyright (C) 2006,2007 Shawn Pearce
#
# Based git's git-completion.sh: http://repo.or.cz/w/git/fastimport.git
__tig_complete_revlist
}
+_tig_blame ()
+{
+ local reply="" ref=HEAD cur="${COMP_WORDS[COMP_CWORD]}"
+
+ if test "$COMP_CWORD" -lt 3; then
+ reply="$(__tig_refs)"
+ else
+ ref="${COMP_WORDS[2]}"
+ fi
+
+ reply="$reply $(git --git-dir="$(__tigdir)" ls-tree "$ref" \
+ | sed '/^100... blob /s,^.* ,,
+ /^040000 tree /{
+ s,^.* ,,
+ s,$,/,
+ }
+ s/^.* //')"
+ _tigcomp "$reply"
+}
+
_tig_show ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
case "${COMP_WORDS[COMP_CWORD]}" in
--*=*) COMPREPLY=() ;;
-*) _tig_options ;;
- *) _tigcomp "status show $(__tig_refs)" ;;
+ *) _tigcomp "blame status show $(__tig_refs)" ;;
esac
return
fi
case "$command" in
+ blame) _tig_blame ;;
show) _tig_show ;;
status) ;;
*) _tigcomp "