bash: Add completion for gitk --merge
authorRichard Quirk <richard.quirk@gmail.com>
Sun, 27 Apr 2008 15:35:10 +0000 (17:35 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Apr 2008 04:38:22 +0000 (21:38 -0700)
Option is only completed when .git/MERGE_HEAD is present.

Signed-off-by: Richard Quirk <richard.quirk@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash

index 665a895f5eafff619d30034afba27ac9f597eb4e..23db664f48057b7fa778f0b265510d5b95457c16 100755 (executable)
@@ -1346,9 +1346,14 @@ _git ()
 _gitk ()
 {
        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
        --*)
-               __gitcomp "--not --all"
+               __gitcomp "--not --all $merge"
                return
                ;;
        esac