Merge branch 'dl/complete-submodule-absorbgitdirs'
authorJunio C Hamano <gitster@pobox.com>
Thu, 7 Mar 2019 00:59:53 +0000 (09:59 +0900)
committerJunio C Hamano <gitster@pobox.com>
Thu, 7 Mar 2019 00:59:53 +0000 (09:59 +0900)
Command-line completion (in contrib/) learned to tab-complete the
"git submodule absorbgitdirs" subcommand.

* dl/complete-submodule-absorbgitdirs:
completion: complete git submodule absorbgitdirs

1  2 
contrib/completion/git-completion.bash
index 499e56f83d0a0592abd53686612c79358780eef2,ed41ddeb8d6604c637c6d7100fdc61bd7bc686af..de56879960d5224437e60d81c3e990ac7ed97a18
@@@ -438,7 -438,7 +438,7 @@@ __gitcomp_nl (
  # Callers must take care of providing only paths that match the current path
  # to be completed and adding any prefix path components, if necessary.
  # 1: List of newline-separated matching paths, complete with all prefix
 -#    path componens.
 +#    path components.
  __gitcomp_file_direct ()
  {
        local IFS=$'\n'
@@@ -855,7 -855,7 +855,7 @@@ __git_compute_merge_strategies (
  
  __git_complete_revlist_file ()
  {
 -      local pfx ls ref cur_="$cur"
 +      local dequoted_word pfx ls ref cur_="$cur"
        case "$cur_" in
        *..?*:*)
                return
        ?*:*)
                ref="${cur_%%:*}"
                cur_="${cur_#*:}"
 -              case "$cur_" in
 +
 +              __git_dequote "$cur_"
 +
 +              case "$dequoted_word" in
                ?*/*)
 -                      pfx="${cur_%/*}"
 -                      cur_="${cur_##*/}"
 +                      pfx="${dequoted_word%/*}"
 +                      cur_="${dequoted_word##*/}"
                        ls="$ref:$pfx"
                        pfx="$pfx/"
                        ;;
                *)
 +                      cur_="$dequoted_word"
                        ls="$ref"
                        ;;
                esac
                *)   pfx="$ref:$pfx" ;;
                esac
  
 -              __gitcomp_nl "$(__git ls-tree "$ls" \
 -                              | sed '/^100... blob /{
 -                                         s,^.*        ,,
 -                                         s,$, ,
 -                                     }
 -                                     /^120000 blob /{
 -                                         s,^.*        ,,
 -                                         s,$, ,
 -                                     }
 -                                     /^040000 tree /{
 -                                         s,^.*        ,,
 -                                         s,$,/,
 -                                     }
 -                                     s/^.*    //')" \
 -                      "$pfx" "$cur_" ""
 +              __gitcomp_file "$(__git ls-tree "$ls" \
 +                              | sed 's/^.*    //
 +                                     s/$//')" \
 +                      "$pfx" "$cur_"
                ;;
        *...*)
                pfx="${cur_%...*}..."
@@@ -2573,7 -2580,7 +2573,7 @@@ _git_submodule (
  {
        __git_has_doubledash && return
  
-       local subcommands="add status init deinit update summary foreach sync"
+       local subcommands="add status init deinit update summary foreach sync absorbgitdirs"
        local subcommand="$(__git_find_on_cmdline "$subcommands")"
        if [ -z "$subcommand" ]; then
                case "$cur" in
@@@ -2986,7 -2993,7 +2986,7 @@@ if [[ -n ${ZSH_VERSION-} ]] &
  
                local IFS=$'\n'
                compset -P '*[=:]'
 -              compadd -Q -f -- ${=1} && _ret=0
 +              compadd -f -- ${=1} && _ret=0
        }
  
        __gitcomp_file ()
  
                local IFS=$'\n'
                compset -P '*[=:]'
 -              compadd -Q -p "${2-}" -f -- ${=1} && _ret=0
 +              compadd -p "${2-}" -f -- ${=1} && _ret=0
        }
  
        _git ()