1
0
mirror of https://github.com/git/git.git synced 2024-10-18 15:48:15 +02:00

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 <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Philippe Blain 2023-09-12 17:30:27 +00:00 committed by Junio C Hamano
parent c7153fad2d
commit 0b658eae75

@ -1679,7 +1679,7 @@ __git_untracked_file_modes="all no normal"
__git_trailer_tokens ()
{
git config --name-only --get-regexp trailer.\*.key | awk -F. '{print $2}'
__git config --name-only --get-regexp '^trailer\..*\.key$' | cut -d. -f 2- | rev | cut -d. -f2- | rev
}
_git_commit ()