bash completion: only show 'log --merge' if merging

The gitk completion only shows --merge if MERGE_HEAD is present.
Do it the same way for git-log completion.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Thomas Rast 2009-02-16 17:34:57 +01:00 committed by Junio C Hamano
parent abfd5fa872
commit 67f1fe5f08

View File

@ -937,6 +937,11 @@ _git_log ()
__git_has_doubledash && return __git_has_doubledash && return
local cur="${COMP_WORDS[COMP_CWORD]}" local cur="${COMP_WORDS[COMP_CWORD]}"
local g="$(git rev-parse --git-dir 2>/dev/null)"
local merge=""
if [ -f $g/MERGE_HEAD ]; then
merge="--merge"
fi
case "$cur" in case "$cur" in
--pretty=*) --pretty=*)
__gitcomp " __gitcomp "
@ -968,7 +973,7 @@ _git_log ()
--decorate --diff-filter= --decorate --diff-filter=
--color-words --walk-reflogs --color-words --walk-reflogs
--parents --children --full-history --parents --children --full-history
--merge $merge
" "
return return
;; ;;