Message ID | a31d7a29af91284f6b8720c810a88076edf5cdd1.1694539827.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | c7153fad2d7e11b28d1cde21db040f8accae1900 |
Headers | show |
Series | completion: commit: complete configured trailer tokens | expand |
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 133ec92bfae..b5eb75aadc5 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 | awk -F. '{print $2}' +} + _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