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>
Thomas Rast committed
Feb 16, 2009 at 17:34 UTC
bf3c20f6e855521fb92f455a9e70fbe8f107c53d
1 file changed
+6
-1
contrib/completion/git-completion.bash
+6
-1
@@ -1003,6 +1003,11 @@ _git_log ()
1003
__git_has_doubledash && return
1004
1005
local cur="${COMP_WORDS[COMP_CWORD]}"
1006
+ local g="$(git rev-parse --git-dir 2>/dev/null)"
1007
+ local merge=""
1008
+ if [ -f $g/MERGE_HEAD ]; then
1009
+ merge="--merge"
1010
+ fi
1011
case "$cur" in
1012
--pretty=*)
1013
__gitcomp "$__git_log_pretty_formats
@@ -1030,7 +1035,7 @@ _git_log ()
1035
--decorate
1036
--walk-reflogs
1037
--parents --children
1033
- --merge
1038
+ $merge
1039
$__git_diff_common_options
1040
--pickaxe-all --pickaxe-regex
1041
"