From: Junio C Hamano Date: Thu, 8 Mar 2018 21:34:11 +0000 (-0800) Subject: Merge branch 'nd/parseopt-completion' into next X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/2461b7035d80437cfb8be596996643190f5a90e9?hp=-c Merge branch 'nd/parseopt-completion' into next Teach parse-options API an option to help the completion script, and make use of the mechanism in command line completion. * nd/parseopt-completion: completion: more subcommands in _git_notes() completion: complete --{reuse,reedit}-message= for all notes subcmds completion: simplify _git_notes completion: don't set PARSE_OPT_NOCOMPLETE on --rerere-autoupdate --- 2461b7035d80437cfb8be596996643190f5a90e9 diff --combined contrib/completion/git-completion.bash index 58b95ec2fd,2e30950299..f1981aa75d --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@@ -472,7 -472,7 +472,7 @@@ __git_refs ( track="" ;; *) - for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do + for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD; do case "$i" in $match*) if [ -e "$dir/$i" ]; then @@@ -627,7 -627,7 +627,7 @@@ __git_is_configured_remote ( __git_list_merge_strategies () { - git merge -s help 2>&1 | + LANG=C LC_ALL=C git merge -s help 2>&1 | sed -n -e '/[Aa]vailable strategies are: /,/^$/{ s/\.$// s/.*:// @@@ -1105,7 -1105,7 +1105,7 @@@ __git_count_arguments ( } __git_whitespacelist="nowarn warn error error-all fix" -__git_am_inprogress_options="--skip --continue --resolved --abort" +__git_am_inprogress_options="--skip --continue --resolved --abort --quit --show-current-patch" _git_am () { @@@ -1754,8 -1754,7 +1754,7 @@@ _git_merge ( case "$cur" in --*) - __gitcomp_builtin merge "--rerere-autoupdate - --no-rerere-autoupdate + __gitcomp_builtin merge "--no-rerere-autoupdate --no-commit --no-edit --no-ff --no-log --no-progress --no-squash --no-stat @@@ -1816,7 -1815,7 +1815,7 @@@ _git_name_rev ( _git_notes () { - local subcommands='add append copy edit list prune remove show' + local subcommands='add append copy edit get-ref list merge prune remove show' local subcommand="$(__git_find_on_cmdline "$subcommands")" case "$subcommand,$cur" in @@@ -1833,23 -1832,14 +1832,14 @@@ ;; esac ;; - add,--reuse-message=*|append,--reuse-message=*|\ - add,--reedit-message=*|append,--reedit-message=*) + *,--reuse-message=*|*,--reedit-message=*) __git_complete_refs --cur="${cur#*=}" ;; - add,--*) - __gitcomp_builtin notes_add + *,--*) + __gitcomp_builtin notes_$subcommand ;; - append,--*) - __gitcomp_builtin notes_append - ;; - copy,--*) - __gitcomp_builtin notes_copy - ;; - prune,--*) - __gitcomp_builtin notes_prune - ;; - prune,*) + prune,*|get-ref,*) + # this command does not take a ref, do not complete it ;; *) case "$prev" in @@@ -1939,11 -1929,11 +1929,11 @@@ _git_rebase ( { __git_find_repo_path if [ -f "$__git_repo_path"/rebase-merge/interactive ]; then - __gitcomp "--continue --skip --abort --quit --edit-todo" + __gitcomp "--continue --skip --abort --quit --edit-todo --show-current-patch" return elif [ -d "$__git_repo_path"/rebase-apply ] || \ [ -d "$__git_repo_path"/rebase-merge ]; then - __gitcomp "--continue --skip --abort --quit" + __gitcomp "--continue --skip --abort --quit --show-current-patch" return fi __git_complete_strategy && return @@@ -1963,6 -1953,7 +1953,7 @@@ --autostash --no-autostash --verify --no-verify --keep-empty --root --force-rebase --no-ff + --rerere-autoupdate --exec " @@@ -3014,7 -3005,7 +3005,7 @@@ _git_whatchanged ( _git_worktree () { - local subcommands="add list lock prune unlock" + local subcommands="add list lock move prune remove unlock" local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then __gitcomp "$subcommands" @@@ -3032,9 -3023,6 +3023,9 @@@ prune,--*) __gitcomp_builtin worktree_prune ;; + remove,--*) + __gitcomp "--force" + ;; *) ;; esac