summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fde97d8)
raw | patch | inline | side by side (parent: fde97d8)
author | Shawn O. Pearce <spearce@spearce.org> | |
Mon, 27 Nov 2006 08:40:47 +0000 (03:40 -0500) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 27 Nov 2006 20:08:58 +0000 (12:08 -0800) |
Now that git-merge is high-level Porcelain users are going to expect
to be able to use it from the command line, in which case we really
should also be able to complete ref names as parameters.
I'm also including completion support for the merge strategies
that are supported by git-merge.sh, should the user wish to use a
different strategy than their default.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
to be able to use it from the command line, in which case we really
should also be able to complete ref names as parameters.
I'm also including completion support for the merge strategies
that are supported by git-merge.sh, should the user wish to use a
different strategy than their default.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
contrib/completion/git-completion.bash | patch | blob | history |
index a43a177160b3b2952e4025bebc47c820ff4003f7..28bd0e3ba70449132d057edb6b065ba0393056a9 100755 (executable)
done
}
+__git_merge_strategies ()
+{
+ sed -n "/^all_strategies='/{
+ s/^all_strategies='//
+ s/'//
+ p
+ q
+ }" "$(git --exec-path)/git-merge"
+}
+
__git_complete_file ()
{
local pfx ls ref cur="${COMP_WORDS[COMP_CWORD]}"
esac
}
+_git_merge ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ --*)
+ COMPREPLY=($(compgen -W "
+ --no-commit --no-summary --squash
+ " -- "$cur"))
+ return
+ esac
+ if [ $COMP_CWORD -gt 1 -a X-s = "X${COMP_WORDS[COMP_CWORD-1]}" ]
+ then
+ COMPREPLY=($(compgen -W "$(__git_merge_strategies)" -- "$cur"))
+ else
+ COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
+ fi
+}
+
_git_merge_base ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
log) _git_log ;;
ls-remote) _git_ls_remote ;;
ls-tree) _git_ls_tree ;;
+ merge) _git_merge;;
merge-base) _git_merge_base ;;
pull) _git_pull ;;
push) _git_push ;;
complete -o default -o nospace -F _git_log git-log
complete -o default -F _git_ls_remote git-ls-remote
complete -o default -o nospace -F _git_ls_tree git-ls-tree
+complete -o default -F _git_merge git-merge
complete -o default -F _git_merge_base git-merge-base
complete -o default -o nospace -F _git_pull git-pull
complete -o default -o nospace -F _git_push git-push