X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=contrib%2Fcompletion%2Fgit-completion.bash;h=bd25b0a893fc1ff29716a0a6bb1f2215ff1d460c;hb=1631d4b71500ff08d71d571f61519e18990c516b;hp=16205467b1303100b5d67f55371aff749ff5c57d;hpb=4f2ce038374e43e25df7a0cc79dd205cf9541814;p=platform%2Fupstream%2Fgit.git diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 1620546..bd25b0a 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -10,6 +10,7 @@ # *) local and remote tag names # *) .git/remotes file names # *) git 'subcommands' +# *) git email aliases for git-send-email # *) tree paths within 'ref:path/to/file' expressions # *) file paths within current working directory and index # *) common --long-options @@ -663,10 +664,11 @@ __git_list_porcelain_commands () check-mailmap) : plumbing;; check-ref-format) : plumbing;; checkout-index) : plumbing;; + column) : internal helper;; commit-tree) : plumbing;; count-objects) : infrequent;; - credential-cache) : credentials helper;; - credential-store) : credentials helper;; + credential) : credentials;; + credential-*) : credentials helper;; cvsexportcommit) : export;; cvsimport) : import;; cvsserver) : daemon;; @@ -735,35 +737,28 @@ __git_list_porcelain_commands () __git_porcelain_commands= __git_compute_porcelain_commands () { - __git_compute_all_commands test -n "$__git_porcelain_commands" || __git_porcelain_commands=$(__git_list_porcelain_commands) } -__git_pretty_aliases () +# Lists all set config variables starting with the given section prefix, +# with the prefix removed. +__git_get_config_variables () { - local i IFS=$'\n' - for i in $(git --git-dir="$(__gitdir)" config --get-regexp "pretty\..*" 2>/dev/null); do - case "$i" in - pretty.*) - i="${i#pretty.}" - echo "${i/ */}" - ;; - esac + local section="$1" i IFS=$'\n' + for i in $(git --git-dir="$(__gitdir)" config --name-only --get-regexp "^$section\..*" 2>/dev/null); do + echo "${i#$section.}" done } +__git_pretty_aliases () +{ + __git_get_config_variables "pretty" +} + __git_aliases () { - local i IFS=$'\n' - for i in $(git --git-dir="$(__gitdir)" config --get-regexp "alias\..*" 2>/dev/null); do - case "$i" in - alias.*) - i="${i#alias.}" - echo "${i/ */}" - ;; - esac - done + __git_get_config_variables "alias" } # __git_aliased_command requires 1 argument @@ -1097,6 +1092,7 @@ _git_clone () --depth --single-branch --branch + --recurse-submodules " return ;; @@ -1114,7 +1110,7 @@ _git_commit () case "$cur" in --cleanup=*) - __gitcomp "default strip verbatim whitespace + __gitcomp "default scissors strip verbatim whitespace " "" "${cur##--cleanup=}" return ;; @@ -1174,7 +1170,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --no-prefix --src-prefix= --dst-prefix= --inter-hunk-context= --patience --histogram --minimal - --raw --word-diff + --raw --word-diff --word-diff-regex= --dirstat --dirstat= --dirstat-by-file --dirstat-by-file= --cumulative --diff-algorithm= @@ -1317,6 +1313,7 @@ _git_grep () --full-name --line-number --extended-regexp --basic-regexp --fixed-strings --perl-regexp + --threads --files-with-matches --name-only --files-without-match --max-depth @@ -1343,15 +1340,15 @@ _git_help () { case "$cur" in --*) - __gitcomp "--all --info --man --web" + __gitcomp "--all --guides --info --man --web" return ;; esac __git_compute_all_commands __gitcomp "$__git_all_commands $(__git_aliases) attributes cli core-tutorial cvs-migration - diffcore gitk glossary hooks ignore modules - namespaces repository-layout tutorial tutorial-2 + diffcore everyday gitk glossary hooks ignore modules + namespaces repository-layout revisions tutorial tutorial-2 workflows " } @@ -1422,7 +1419,7 @@ __git_log_gitk_options=" # Options that go well for log and shortlog (not gitk) __git_log_shortlog_options=" --author= --committer= --grep= - --all-match + --all-match --invert-grep " __git_log_pretty_formats="oneline short medium full fuller email raw format:" @@ -1448,7 +1445,7 @@ _git_log () return ;; --decorate=*) - __gitcomp "long short" "" "${cur##--decorate=}" + __gitcomp "full short no" "" "${cur##--decorate=}" return ;; --*) @@ -1462,6 +1459,7 @@ _git_log () --relative-date --date= --pretty= --format= --oneline --show-signature + --cherry-mark --cherry-pick --graph --decorate --decorate= @@ -1673,7 +1671,10 @@ _git_push () _git_rebase () { local dir="$(__gitdir)" - if [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then + if [ -f "$dir"/rebase-merge/interactive ]; then + __gitcomp "--continue --skip --abort --edit-todo" + return + elif [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then __gitcomp "--continue --skip --abort" return fi @@ -1689,8 +1690,12 @@ _git_rebase () --preserve-merges --stat --no-stat --committer-date-is-author-date --ignore-date --ignore-whitespace --whitespace= - --autosquash --fork-point --no-fork-point - --autostash + --autosquash --no-autosquash + --fork-point --no-fork-point + --autostash --no-autostash + --verify --no-verify + --keep-empty --root --force-rebase --no-ff + --exec " return @@ -1715,6 +1720,15 @@ __git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all" _git_send_email () { + case "$prev" in + --to|--cc|--bcc|--from) + __gitcomp " + $(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null) + " + return + ;; + esac + case "$cur" in --confirm=*) __gitcomp " @@ -1739,6 +1753,12 @@ _git_send_email () " "" "${cur##--thread=}" return ;; + --to=*|--cc=*|--bcc=*|--from=*) + __gitcomp " + $(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null) + " "" "${cur#--*=}" + return + ;; --*) __gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to --compose --confirm= --dry-run --envelope-sender @@ -1780,15 +1800,7 @@ __git_config_get_set_variables () c=$((--c)) done - git --git-dir="$(__gitdir)" config $config_file --list 2>/dev/null | - while read -r line - do - case "$line" in - *.*=*) - echo "${line/=*/}" - ;; - esac - done + git --git-dir="$(__gitdir)" config $config_file --name-only --list 2>/dev/null } _git_config () @@ -1803,7 +1815,7 @@ _git_config () return ;; branch.*.rebase) - __gitcomp "false true" + __gitcomp "false true preserve interactive" return ;; remote.pushdefault) @@ -1893,6 +1905,7 @@ _git_config () --get --get-all --get-regexp --add --unset --unset-all --remove-section --rename-section + --name-only " return ;; @@ -2049,6 +2062,7 @@ _git_config () core.sparseCheckout core.symlinks core.trustctime + core.untrackedCache core.warnAmbiguousRefs core.whitespace core.worktree @@ -2123,6 +2137,8 @@ _git_config () http.noEPSV http.postBuffer http.proxy + http.sslCipherList + http.sslVersion http.sslCAInfo http.sslCAPath http.sslCert @@ -2186,6 +2202,7 @@ _git_config () pull.octopus pull.twohead push.default + push.followTags rebase.autosquash rebase.stat receive.autogc @@ -2259,12 +2276,7 @@ _git_remote () __git_complete_remote_or_refspec ;; update) - local i c='' IFS=$'\n' - for i in $(git --git-dir="$(__gitdir)" config --get-regexp "remotes\..*" 2>/dev/null); do - i="${i#remotes.}" - c="$c ${i/ */}" - done - __gitcomp "$c" + __gitcomp "$(__git_get_config_variables "remotes")" ;; *) ;; @@ -2291,6 +2303,11 @@ _git_reset () _git_revert () { + local dir="$(__gitdir)" + if [ -f "$dir"/REVERT_HEAD ]; then + __gitcomp "--continue --quit --abort" + return + fi case "$cur" in --*) __gitcomp "--edit --mainline --no-edit --no-commit --signoff" @@ -2359,7 +2376,7 @@ _git_show_branch () case "$cur" in --*) __gitcomp " - --all --remotes --topo-order --current --more= + --all --remotes --topo-order --date-order --current --more= --list --independent --merge-base --no-name --color --no-color --sha1-name --sparse --topics --reflog @@ -2372,7 +2389,7 @@ _git_show_branch () _git_stash () { - local save_opts='--keep-index --no-keep-index --quiet --patch' + local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked' local subcommands='save list show apply clear drop pop create branch' local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then @@ -2394,9 +2411,20 @@ _git_stash () apply,--*|pop,--*) __gitcomp "--index --quiet" ;; - show,--*|drop,--*|branch,--*) + drop,--*) + __gitcomp "--quiet" + ;; + show,--*|branch,--*) + ;; + branch,*) + if [ $cword -eq 3 ]; then + __gitcomp_nl "$(__git_refs)"; + else + __gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \ + | sed -n -e 's/:.*//p')" + fi ;; - show,*|apply,*|drop,*|pop,*|branch,*) + show,*|apply,*|drop,*|pop,*) __gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \ | sed -n -e 's/:.*//p')" ;;