Skip to content

Commit 67f1fe5

Browse files
trastgitster
authored andcommitted
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 <[email protected]> Acked-by: Shawn O. Pearce <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent abfd5fa commit 67f1fe5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

contrib/completion/git-completion.bash

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,11 @@ _git_log ()
937937
__git_has_doubledash && return
938938

939939
local cur="${COMP_WORDS[COMP_CWORD]}"
940+
local g="$(git rev-parse --git-dir 2>/dev/null)"
941+
local merge=""
942+
if [ -f $g/MERGE_HEAD ]; then
943+
merge="--merge"
944+
fi
940945
case "$cur" in
941946
--pretty=*)
942947
__gitcomp "
@@ -968,7 +973,7 @@ _git_log ()
968973
--decorate --diff-filter=
969974
--color-words --walk-reflogs
970975
--parents --children --full-history
971-
--merge
976+
$merge
972977
"
973978
return
974979
;;

0 commit comments

Comments
 (0)