Skip to content

Commit e9dac4b

Browse files
committed
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
2 parents 671eaaa + 0b658ea commit e9dac4b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

contrib/completion/git-completion.bash

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,6 +1677,11 @@ _git_clone ()
16771677

16781678
__git_untracked_file_modes="all no normal"
16791679

1680+
__git_trailer_tokens ()
1681+
{
1682+
__git config --name-only --get-regexp '^trailer\..*\.key$' | cut -d. -f 2- | rev | cut -d. -f2- | rev
1683+
}
1684+
16801685
_git_commit ()
16811686
{
16821687
case "$prev" in
@@ -1701,6 +1706,10 @@ _git_commit ()
17011706
__gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}"
17021707
return
17031708
;;
1709+
--trailer=*)
1710+
__gitcomp_nl "$(__git_trailer_tokens)" "" "${cur##--trailer=}" ":"
1711+
return
1712+
;;
17041713
--*)
17051714
__gitcomp_builtin commit
17061715
return

0 commit comments

Comments
 (0)