From: Kyle Meyer <kyle@kyleam.com>
To: meta@public-inbox.org
Subject: [PATCH] lei rediff: fix construction of git-diff options
Date: Fri, 21 May 2021 00:38:16 -0400 [thread overview]
Message-ID: <20210521043816.23838-1-kyle@kyleam.com> (raw)
When generating git-diff options, lei-rediff extracts the single
character option from the lei option spec. However, there's no check
that the regular expression actually matches, leading to an
unintentional git-diff option when there isn't a short option (e.g.,
--inter-hunk-context=1 maps to the invalid `git diff --color -w1').
Check for a match before trying to extract the single character
option.
Fixes: cf0c7ce3ce81b5c3 (lei rediff: regenerate diffs from stdin)
---
lib/PublicInbox/LeiRediff.pm | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/PublicInbox/LeiRediff.pm b/lib/PublicInbox/LeiRediff.pm
index 3c8ebe41..2e793df5 100644
--- a/lib/PublicInbox/LeiRediff.pm
+++ b/lib/PublicInbox/LeiRediff.pm
@@ -108,8 +108,9 @@ EOM
push @cmd, '--'.($opt->{color} && !$opt->{'no-color'} ? '' : 'no-').
'color';
for my $o (@PublicInbox::LEI::diff_opt) {
- $o =~ s/\|([a-z0-9])\b//i; # remove single char short option
- my $c = $1;
+ my $c = '';
+ # remove single char short option
+ $o =~ s/\|([a-z0-9])\b//i and $c = $1;
if ($o =~ s/=[is]@\z//) {
my $v = $opt->{$o} or next;
push @cmd, map { $c ? "-$c$_" : "--$o=$_" } @$v;
base-commit: 2f720902ed702b64d918165ba21a96dabbeeca26
--
2.31.1
next reply other threads:[~2021-05-21 4:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-21 4:38 Kyle Meyer [this message]
2021-05-21 9:52 ` [PATCH] lei rediff: fix construction of git-diff options Eric Wong
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
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210521043816.23838-1-kyle@kyleam.com \
--to=kyle@kyleam.com \
--cc=meta@public-inbox.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).