Merge branch 'nd/parseopt-completion' into next
authorJunio C Hamano <gitster@pobox.com>
Thu, 8 Mar 2018 21:34:11 +0000 (13:34 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Mar 2018 21:34:11 +0000 (13:34 -0800)
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

1  2 
contrib/completion/git-completion.bash
index 58b95ec2fd683d2ae37fef2e227113082c722a56,2e30950299fd74a8f11b0cea86d6d8ffb6ca3226..f1981aa75df2128f93a3d6b5b3434ab6bda86576
@@@ -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
                        ;;
                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
                        --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"
                prune,--*)
                        __gitcomp_builtin worktree_prune
                        ;;
 +              remove,--*)
 +                      __gitcomp "--force"
 +                      ;;
                *)
                        ;;
                esac