Skip to content

Commit 0b658ea

Browse files
phil-blaingitster
authored andcommitted
completion: commit: complete trailers tokens more robustly
In the previous commit, we added support for completing configured trailer tokens in 'git commit --trailer'. Make the implementation more robust by: - using '__git' instead of plain 'git', as the rest of the completion script does - using a stricter pattern for --get-regexp to avoid false hits - using 'cut' and 'rev' instead of 'awk' to account for tokens including dots. Signed-off-by: Philippe Blain <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c7153fa commit 0b658ea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

contrib/completion/git-completion.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1679,7 +1679,7 @@ __git_untracked_file_modes="all no normal"
16791679

16801680
__git_trailer_tokens ()
16811681
{
1682-
git config --name-only --get-regexp trailer.\*.key | awk -F. '{print $2}'
1682+
__git config --name-only --get-regexp '^trailer\..*\.key$' | cut -d. -f 2- | rev | cut -d. -f2- | rev
16831683
}
16841684

16851685
_git_commit ()

0 commit comments

Comments
 (0)