Message ID | 87edtp5uws.fsf@kyleam.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 8774aa56ad1af286b34e6ac7f1e65c75a4477fdd |
Headers | show |
Series | [v2] send-email: relay '-v N' to format-patch | expand |
Kyle Meyer <kyle@kyleam.com> writes: > Here's a patch handling the -v case. I don't plan on working on a more > complete fix for the other cases (as I mentioned before, I don't use > send-email to drive format-patch), but in my opinion the -v fix by > itself is still valuable. Yup, I think it is a good place to stop for the first patch. Other people can add more when they discover the need, and anything more complex [*] is probably not worth the effort, I would think. Side note: [*] we could imagine running "git format-patch -h" (or a new variant of it), parse its output and populate the %options dynamically, for example. Will queue. Thanks.
Kyle Meyer <kyle@kyleam.com> writes: > diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh > index 01c74b8b07..152bd2c697 100755 > --- a/t/t9001-send-email.sh > +++ b/t/t9001-send-email.sh > @@ -2334,6 +2334,12 @@ test_expect_success $PREREQ 'test that send-email works outside a repo' ' > "$(pwd)/0001-add-main.patch" > ' > > +test_expect_success $PREREQ 'send-email relays -v 3 to format-patch' ' > + test_when_finished "rm -f out" && > + git send-email --dry-run -v 3 -1 >out && > + grep "PATCH v3" out > +' > + > test_expect_success $PREREQ 'test that sendmail config is rejected' ' > test_config sendmail.program sendmail && > test_must_fail git send-email \ > > base-commit: e7e5c6f715b2de7bea0d39c7d2ba887335b40aa0 It seems that this new test, by invoking format-patch, makes a leaks check at GitHub CI fail. https://github.com/git/git/actions/runs/3562362890/jobs/5984036422 Dropping PASSES_SANITIZE_LEAK from the test script would certainly be a short-term workaround, though, but it is a rather broad mechanism. There should be a better way to control the leak checker, but that is what we currently have X-<.
On Sun, Nov 27 2022, Junio C Hamano wrote: > Kyle Meyer <kyle@kyleam.com> writes: > >> Here's a patch handling the -v case. I don't plan on working on a more >> complete fix for the other cases (as I mentioned before, I don't use >> send-email to drive format-patch), but in my opinion the -v fix by >> itself is still valuable. > > Yup, I think it is a good place to stop for the first patch. Other > people can add more when they discover the need, and anything more > complex [*] is probably not worth the effort, I would think. > > Side note: [*] we could imagine running "git format-patch -h" > (or a new variant of it), parse its output and populate the > %options dynamically, for example. > > Will queue. Thanks. This is just a comment on the #leftoverbits: I've looked at this option parsing in "git-send-email" before, and IMO the right long-term fix is to split out the *.perl code into a "git send-email--helper", and do the option parsing in C using our parse_options(). Some of it will be a bit of a hassle, but it should be much easier after 8de2e2e41b2 (Merge branch 'ab/send-email-optim', 2021-07-22) (and the subsquent regression fix).
diff --git a/git-send-email.perl b/git-send-email.perl index 5861e99a6e..07f2a0cbea 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -220,6 +220,10 @@ sub format_2822_time { my $force = 0; my $dump_aliases = 0; +# Variables to prevent short format-patch options from being captured +# as abbreviated send-email options +my $reroll_count; + # Handle interactive edition of files. my $multiedit; my $editor; @@ -542,6 +546,7 @@ sub config_regexp { "batch-size=i" => \$batch_size, "relogin-delay=i" => \$relogin_delay, "git-completion-helper" => \$git_completion_helper, + "v=s" => \$reroll_count, ); $rc = GetOptions(%options); @@ -782,7 +787,9 @@ sub is_format_patch_arg { die __("Cannot run git format-patch from outside a repository\n") unless $repo; require File::Temp; - push @files, $repo->command('format-patch', '-o', File::Temp::tempdir(CLEANUP => 1), @rev_list_opts); + push @files, $repo->command('format-patch', '-o', File::Temp::tempdir(CLEANUP => 1), + defined $reroll_count ? ('-v', $reroll_count) : (), + @rev_list_opts); } @files = handle_backup_files(@files); diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 01c74b8b07..152bd2c697 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -2334,6 +2334,12 @@ test_expect_success $PREREQ 'test that send-email works outside a repo' ' "$(pwd)/0001-add-main.patch" ' +test_expect_success $PREREQ 'send-email relays -v 3 to format-patch' ' + test_when_finished "rm -f out" && + git send-email --dry-run -v 3 -1 >out && + grep "PATCH v3" out +' + test_expect_success $PREREQ 'test that sendmail config is rejected' ' test_config sendmail.program sendmail && test_must_fail git send-email \