Skip to content

Commit

Permalink
Merge branch 'pb/complete-commit-trailers' into next
Browse files Browse the repository at this point in the history
The command-line complation support (in contrib/) learned to
complete "git commit --trailer=" for possible trailer keys.

* pb/complete-commit-trailers:
  completion: commit: complete configured trailer tokens
  • Loading branch information
gitster committed Sep 8, 2023
2 parents 3384903 + c7153fa commit 8425870
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 8425870

Please sign in to comment.