git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] send-email: show --no options correctly

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Mar 31, 2023, 01:53 UTC
Message-ID
<20230331015357.154459-1-felipe.contreras@gmail.com>

All of the --no options need to be after the `--`, otherwise the completion will show them initially.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 git-send-email.perl | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 07f2a0cbea..f0d80baa01 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -142,9 +142,10 @@ sub completion_helper {
 
 	my @format_patch_opts = split(/ /, Git::command('format-patch', '--git-completion-helper'));
 	my @opts = (@send_email_opts, @format_patch_opts);
-	@opts = uniq (grep !/^$/, @opts);
-	# There's an implicit '\n' here already, no need to add an explicit one.
-	print "@opts";
+	@opts = uniq (grep !/^(--|)$/, @opts);
+	my @pos_opts = grep(!/^--no/, @opts);
+	my @neg_opts = grep(/^--no/, @opts);
+	print "@pos_opts -- @neg_opts";
 	exit(0);
 }
 
-- 
2.40.0.133.g8a4477c8d7.dirty
Message 1 of 1 in “send-email: show --no options correctly”
  1. send-email: show --no options correctlyFelipe Contreras, Mar 31, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.