From: "Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "ZheNing Hu" <adlternative@gmail.com>,
"Martin Ågren" <martin.agren@gmail.com>,
"Philippe Blain" <levraiphilippeblain@gmail.com>,
"Philippe Blain" <levraiphilippeblain@gmail.com>,
"Philippe Blain" <levraiphilippeblain@gmail.com>
Subject: [PATCH v2 2/2] completion: commit: complete trailers tokens more robustly
Date: Tue, 12 Sep 2023 17:30:27 +0000 [thread overview]
Message-ID: <9cb33c20294e096f5345fb1ea9d80a23e899ae6f.1694539827.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1583.v2.git.1694539827.gitgitgadget@gmail.com>
From: Philippe Blain <levraiphilippeblain@gmail.com>
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>
---
contrib/completion/git-completion.bash | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index b5eb75aadc5..c23465886e0 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -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 ()
--
gitgitgadget
next prev parent reply other threads:[~2023-09-12 17:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-07 17:42 [PATCH] completion: commit: complete configured trailer tokens Philippe Blain via GitGitGadget
2023-09-07 20:20 ` Junio C Hamano
2023-09-11 10:20 ` Martin Ågren
2023-09-12 12:02 ` Philippe Blain
2023-09-12 17:30 ` [PATCH v2 0/2] " Philippe Blain via GitGitGadget
2023-09-12 17:30 ` [PATCH v2 1/2] " Philippe Blain via GitGitGadget
2023-09-12 17:30 ` Philippe Blain via GitGitGadget [this message]
2023-09-13 0:34 ` [PATCH v2 2/2] completion: commit: complete trailers tokens more robustly Junio C Hamano
2023-09-16 13:30 ` [PATCH] completion: commit: complete configured trailer tokens ZheNing Hu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9cb33c20294e096f5345fb1ea9d80a23e899ae6f.1694539827.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=adlternative@gmail.com \
--cc=git@vger.kernel.org \
--cc=levraiphilippeblain@gmail.com \
--cc=martin.agren@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).