From: Junio C Hamano Date: Wed, 15 Feb 2017 20:54:19 +0000 (-0800) Subject: Merge branch 'cw/completion' X-Git-Tag: v2.12.0-rc2~17 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/3f4ccb5a579740382fa7685e6d1a00d157b44387?hp=-c Merge branch 'cw/completion' More command line completion (in contrib/) for recent additions. * cw/completion: completion: recognize more long-options completion: teach remote subcommands to complete options completion: teach replace to complete options completion: teach ls-remote to complete options completion: improve bash completion for git-add completion: add subcommand completion for rerere completion: teach submodule subcommands to complete options --- 3f4ccb5a579740382fa7685e6d1a00d157b44387 diff --combined contrib/completion/git-completion.bash index 6c6e1c774d,b09b55f429..41ee52991d --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@@ -936,6 -936,7 +936,7 @@@ _git_apply ( --apply --no-add --exclude= --ignore-whitespace --ignore-space-change --whitespace= --inaccurate-eof --verbose + --recount --directory= " return esac @@@ -947,13 -948,17 +948,17 @@@ _git_add ( --*) __gitcomp " --interactive --refresh --patch --update --dry-run - --ignore-errors --intent-to-add + --ignore-errors --intent-to-add --force --edit --chmod= " return esac - # XXX should we check for --update and --all options ? - __git_complete_index_file "--others --modified --directory --no-empty-directory" + local complete_opt="--others --modified --directory --no-empty-directory" + if test -n "$(__git_find_on_cmdline "-u --update")" + then + complete_opt="--modified" + fi + __git_complete_index_file "$complete_opt" } _git_archive () @@@ -970,7 -975,7 +975,7 @@@ --*) __gitcomp " --format= --list --verbose - --prefix= --remote= --exec= + --prefix= --remote= --exec= --output " return ;; @@@ -1025,6 -1030,7 +1030,7 @@@ _git_branch ( --track --no-track --contains --merged --no-merged --set-upstream-to= --edit-description --list --unset-upstream --delete --move --remotes + --column --no-column --sort= --points-at " ;; *) @@@ -1138,6 -1144,8 +1144,8 @@@ _git_clone ( --single-branch --branch --recurse-submodules + --no-single-branch + --shallow-submodules " return ;; @@@ -1179,6 -1187,7 +1187,7 @@@ _git_commit ( --reset-author --file= --message= --template= --cleanup= --untracked-files --untracked-files= --verbose --quiet --fixup= --squash= + --patch --short --date --allow-empty " return esac @@@ -1197,7 -1206,7 +1206,7 @@@ _git_describe ( --*) __gitcomp " --all --tags --contains --abbrev= --candidates= - --exact-match --debug --long --match --always + --exact-match --debug --long --match --always --first-parent " return esac @@@ -1280,6 -1289,7 +1289,7 @@@ __git_fetch_recurse_submodules="yes on- __git_fetch_options=" --quiet --verbose --append --upload-pack --force --keep --depth= --tags --no-tags --all --prune --dry-run --recurse-submodules= + --unshallow --update-shallow " _git_fetch () @@@ -1329,7 -1339,7 +1339,7 @@@ _git_fsck ( --*) __gitcomp " --tags --root --unreachable --cache --no-reflogs --full - --strict --verbose --lost-found + --strict --verbose --lost-found --name-objects " return ;; @@@ -1373,6 -1383,8 +1383,8 @@@ _git_grep ( --max-depth --count --and --or --not --all-match + --break --heading --show-function --function-context + --untracked --no-index " return ;; @@@ -1445,6 -1457,12 +1457,12 @@@ _git_ls_files ( _git_ls_remote () { + case "$cur" in + --*) + __gitcomp "--heads --tags --refs --get-url --symref" + return + ;; + esac __gitcomp_nl "$(__git_remotes)" } @@@ -1566,7 -1584,7 +1584,7 @@@ _git_mergetool ( return ;; --*) - __gitcomp "--tool=" + __gitcomp "--tool= --prompt --no-prompt" return ;; esac @@@ -1674,7 -1692,7 +1692,7 @@@ _git_pull ( __git_complete_remote_or_refspec } -__git_push_recurse_submodules="check on-demand" +__git_push_recurse_submodules="check on-demand only" __git_complete_force_with_lease () { @@@ -2374,40 -2392,88 +2392,88 @@@ _git_config ( _git_remote () { - local subcommands="add rename remove set-head set-branches set-url show prune update" + local subcommands=" + add rename remove set-head set-branches + get-url set-url show prune update + " local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then - __gitcomp "$subcommands" + case "$cur" in + --*) + __gitcomp "--verbose" + ;; + *) + __gitcomp "$subcommands" + ;; + esac return fi - case "$subcommand" in - rename|remove|set-url|show|prune) - __gitcomp_nl "$(__git_remotes)" + case "$subcommand,$cur" in + add,--*) + __gitcomp "--track --master --fetch --tags --no-tags --mirror=" + ;; + add,*) + ;; + set-head,--*) + __gitcomp "--auto --delete" + ;; + set-branches,--*) + __gitcomp "--add" ;; - set-head|set-branches) + set-head,*|set-branches,*) __git_complete_remote_or_refspec ;; - update) + update,--*) + __gitcomp "--prune" + ;; + update,*) __gitcomp "$(__git_get_config_variables "remotes")" ;; + set-url,--*) + __gitcomp "--push --add --delete" + ;; + get-url,--*) + __gitcomp "--push --all" + ;; + prune,--*) + __gitcomp "--dry-run" + ;; *) + __gitcomp_nl "$(__git_remotes)" ;; esac } _git_replace () { + case "$cur" in + --*) + __gitcomp "--edit --graft --format= --list --delete" + return + ;; + esac __gitcomp_nl "$(__git_refs)" } + _git_rerere () + { + local subcommands="clear forget diff remaining status gc" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if test -z "$subcommand" + then + __gitcomp "$subcommands" + return + fi + } + _git_reset () { __git_has_doubledash && return case "$cur" in --*) - __gitcomp "--merge --mixed --hard --soft --patch" + __gitcomp "--merge --mixed --hard --soft --patch --keep" return ;; esac @@@ -2423,7 -2489,10 +2489,10 @@@ _git_revert ( fi case "$cur" in --*) - __gitcomp "--edit --mainline --no-edit --no-commit --signoff" + __gitcomp " + --edit --mainline --no-edit --no-commit --signoff + --strategy= --strategy-option= + " return ;; esac @@@ -2451,7 -2520,7 +2520,7 @@@ _git_shortlog ( __gitcomp " $__git_log_common_options $__git_log_shortlog_options - --numbered --summary + --numbered --summary --email " return ;; @@@ -2556,10 -2625,11 +2625,11 @@@ _git_submodule ( __git_has_doubledash && return local subcommands="add status init deinit update summary foreach sync" - if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then case "$cur" in --*) - __gitcomp "--quiet --cached" + __gitcomp "--quiet" ;; *) __gitcomp "$subcommands" @@@ -2567,6 -2637,33 +2637,33 @@@ esac return fi + + case "$subcommand,$cur" in + add,--*) + __gitcomp "--branch --force --name --reference --depth" + ;; + status,--*) + __gitcomp "--cached --recursive" + ;; + deinit,--*) + __gitcomp "--force --all" + ;; + update,--*) + __gitcomp " + --init --remote --no-fetch + --recommend-shallow --no-recommend-shallow + --force --rebase --merge --reference --depth --recursive --jobs + " + ;; + summary,--*) + __gitcomp "--cached --files --summary-limit" + ;; + foreach,--*|sync,--*) + __gitcomp "--recursive" + ;; + *) + ;; + esac } _git_svn () @@@ -2587,14 -2684,14 +2684,14 @@@ --no-metadata --use-svm-props --use-svnsync-props --log-window-size= --no-checkout --quiet --repack-flags --use-log-author --localtime + --add-author-from --ignore-paths= --include-paths= $remote_opts " local init_opts=" --template= --shared= --trunk= --tags= --branches= --stdlayout --minimize-url --no-metadata --use-svm-props --use-svnsync-props - --rewrite-root= --prefix= --use-log-author - --add-author-from $remote_opts + --rewrite-root= --prefix= $remote_opts " local cmt_opts=" --edit --rmdir --find-copies-harder --copy-similarity= @@@ -2701,8 -2798,8 +2798,8 @@@ _git_tag ( --*) __gitcomp " --list --delete --verify --annotate --message --file - --sign --cleanup --local-user --force --column --sort - --contains --points-at + --sign --cleanup --local-user --force --column --sort= + --contains --points-at --merged --no-merged --create-reflog " ;; esac