Skip to content

Commit 531d13d

Browse files
committed
Merge branch 'km/send-email-with-v-reroll-count'
"git send-email -v 3" used to be expanded to "git send-email --validate 3" when the user meant to pass them down to "format-patch", which has been corrected. * km/send-email-with-v-reroll-count: send-email: relay '-v N' to format-patch
2 parents 557d93a + 8774aa5 commit 531d13d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

git-send-email.perl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ sub format_2822_time {
220220
my $force = 0;
221221
my $dump_aliases = 0;
222222

223+
# Variables to prevent short format-patch options from being captured
224+
# as abbreviated send-email options
225+
my $reroll_count;
226+
223227
# Handle interactive edition of files.
224228
my $multiedit;
225229
my $editor;
@@ -542,6 +546,7 @@ sub config_regexp {
542546
"batch-size=i" => \$batch_size,
543547
"relogin-delay=i" => \$relogin_delay,
544548
"git-completion-helper" => \$git_completion_helper,
549+
"v=s" => \$reroll_count,
545550
);
546551
$rc = GetOptions(%options);
547552

@@ -782,7 +787,9 @@ sub is_format_patch_arg {
782787
die __("Cannot run git format-patch from outside a repository\n")
783788
unless $repo;
784789
require File::Temp;
785-
push @files, $repo->command('format-patch', '-o', File::Temp::tempdir(CLEANUP => 1), @rev_list_opts);
790+
push @files, $repo->command('format-patch', '-o', File::Temp::tempdir(CLEANUP => 1),
791+
defined $reroll_count ? ('-v', $reroll_count) : (),
792+
@rev_list_opts);
786793
}
787794

788795
@files = handle_backup_files(@files);

t/t9001-send-email.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,6 +2334,12 @@ test_expect_success $PREREQ 'test that send-email works outside a repo' '
23342334
"$(pwd)/0001-add-main.patch"
23352335
'
23362336

2337+
test_expect_success $PREREQ 'send-email relays -v 3 to format-patch' '
2338+
test_when_finished "rm -f out" &&
2339+
git send-email --dry-run -v 3 -1 >out &&
2340+
grep "PATCH v3" out
2341+
'
2342+
23372343
test_expect_success $PREREQ 'test that sendmail config is rejected' '
23382344
test_config sendmail.program sendmail &&
23392345
test_must_fail git send-email \

0 commit comments

Comments
 (0)