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>

Philippe Blain committed Sep 12, 2023 at 17:30 UTC 0b658eae751968506552f1bddadc338653819d20
1 file changed +1 -1
contrib/completion/git-completion.bash
+1 -1
@@ -1679,7 +1679,7 @@ __git_untracked_file_modes="all no normal"
1679
1680 __git_trailer_tokens ()
1681 {
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
1683 }
1684
1685 _git_commit ()