Skip to contentSkip to conversation

send-email: show --no options correctly

PATCH New Felipe Contreras 1 participant 1 message Mar 31, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 send-email: show --no options correctly

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

---
 git-send-email.perl | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
git-send-email.perl +4 -3
index 07f2a0cbea..f0d80baa01 100755
@@ -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);
 }
 
Signature · 1 line
2.40.0.133.g8a4477c8d7.dirty