From: Junio C Hamano Date: Thu, 30 Mar 2017 21:07:15 +0000 (-0700) Subject: Merge branch 'sg/completion-ctags' X-Git-Tag: v2.13.0-rc0~45 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/ccf680dea305e0b2bda31a29c37e40e5beb397c8?hp=-c Merge branch 'sg/completion-ctags' Command line completion updates. * sg/completion-ctags: completion: offer ctags symbol names for 'git log -S', '-G' and '-L:' completion: extract completing ctags symbol names into helper function completion: put matching ctags symbol names directly into COMPREPLY --- ccf680dea305e0b2bda31a29c37e40e5beb397c8 diff --combined contrib/completion/git-completion.bash index 380f755b9f,d6f25a7e0b..dd862e018d --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@@ -1102,7 -1102,6 +1102,7 @@@ _git_apply ( --apply --no-add --exclude= --ignore-whitespace --ignore-space-change --whitespace= --inaccurate-eof --verbose + --recount --directory= " return esac @@@ -1114,17 -1113,13 +1114,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 () @@@ -1141,7 -1136,7 +1141,7 @@@ --*) __gitcomp " --format= --list --verbose - --prefix= --remote= --exec= + --prefix= --remote= --exec= --output " return ;; @@@ -1197,7 -1192,6 +1197,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 " ;; *) @@@ -1311,8 -1305,6 +1311,8 @@@ _git_clone ( --single-branch --branch --recurse-submodules + --no-single-branch + --shallow-submodules " return ;; @@@ -1354,7 -1346,6 +1354,7 @@@ _git_commit ( --reset-author --file= --message= --template= --cleanup= --untracked-files --untracked-files= --verbose --quiet --fixup= --squash= + --patch --short --date --allow-empty " return esac @@@ -1373,8 -1364,7 +1373,8 @@@ _git_describe ( --*) __gitcomp " --all --tags --contains --abbrev= --candidates= - --exact-match --debug --long --match --always + --exact-match --debug --long --match --always --first-parent + --exclude " return esac @@@ -1457,7 -1447,6 +1457,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 () @@@ -1507,7 -1496,7 +1507,7 @@@ _git_fsck ( --*) __gitcomp " --tags --root --unreachable --cache --no-reflogs --full - --strict --verbose --lost-found + --strict --verbose --lost-found --name-objects " return ;; @@@ -1529,8 -1518,43 +1529,43 @@@ _git_gitk ( _gitk } - __git_match_ctag() { - awk "/^${1//\//\\/}/ { print \$1 }" "$2" + # Lists matching symbol names from a tag (as in ctags) file. + # 1: List symbol names matching this word. + # 2: The tag file to list symbol names from. + # 3: A prefix to be added to each listed symbol name (optional). + # 4: A suffix to be appended to each listed symbol name (optional). + __git_match_ctag () { + awk -v pfx="${3-}" -v sfx="${4-}" " + /^${1//\//\\/}/ { print pfx \$1 sfx } + " "$2" + } + + # Complete symbol names from a tag file. + # Usage: __git_complete_symbol [