diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-09-20 20:44:57 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-09-20 20:44:57 +0300 |
commit | e9dac4b86c2c06f834eedad88302b76d2981c039 (patch) | |
tree | 7ca2635cd7466b4095fb0d0ee83d8d0a22a583f2 /contrib | |
parent | 671eaaac0caac4826d6182bd5a57c9e0a8ed7a27 (diff) | |
parent | 0b658eae751968506552f1bddadc338653819d20 (diff) |
Merge branch 'pb/complete-commit-trailers'
The command-line complation support (in contrib/) learned to
complete "git commit --trailer=" for possible trailer keys.
* pb/complete-commit-trailers:
completion: commit: complete trailers tokens more robustly
completion: commit: complete configured trailer tokens
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/completion/git-completion.bash | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 745dc901fb..52b1b016cd 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1677,6 +1677,11 @@ _git_clone () __git_untracked_file_modes="all no normal" +__git_trailer_tokens () +{ + __git config --name-only --get-regexp '^trailer\..*\.key$' | cut -d. -f 2- | rev | cut -d. -f2- | rev +} + _git_commit () { case "$prev" in @@ -1701,6 +1706,10 @@ _git_commit () __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}" return ;; + --trailer=*) + __gitcomp_nl "$(__git_trailer_tokens)" "" "${cur##--trailer=}" ":" + return + ;; --*) __gitcomp_builtin commit return |