[PATCH 1/3] t4150-am: refactor and clean common setup
Add new functions to keep the setup cleaner: - setup_temporary_branch: creates a new branch, check it out and automatically delete it after the test is over - setup_fixed_branch: creates a fixed branch, which can be re-used in later tests Signed-off-by: Remi Lespinet --- t/t4150-am.sh | 138 -- 1 file changed, 47 insertions(+), 91 deletions(-) diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 306e6f3..8370951 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -4,6 +4,20 @@ test_description='git am running' . ./test-lib.sh +setup_temporary_branch () { + tmp_name=${2-"temporary"} + git reset --hard && + rm -fr .git/rebase-apply && + test_when_finished "git checkout $1 && git branch -D $tmp_name" && + git checkout -b "$tmp_name" "$1" +} + +setup_fixed_branch () { + git reset --hard && + rm -fr .git/rebase-apply && + git checkout -b "$1" "$2" +} + test_expect_success 'setup: messages' ' cat >msg <<-\EOF && second @@ -143,9 +157,7 @@ test_expect_success setup ' ' test_expect_success 'am applies patch correctly' ' - rm -fr .git/rebase-apply && - git reset --hard && - git checkout first && + setup_temporary_branch first && test_tick && git am expected && echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" >>expected && @@ -255,9 +257,7 @@ test_expect_success 'am without --keep removes Re: and [PATCH] stuff' ' ' test_expect_success 'am --keep really keeps the subject' ' - rm -fr .git/rebase-apply && - git reset --hard && - git checkout HEAD^ && + setup_temporary_branch master2^ && git am --keep patch4 && test_path_is_missing .git/rebase-apply && git cat-file commit HEAD >actual && @@ -265,9 +265,7 @@ test_expect_success 'am --keep really keeps the subject' ' ' test_expect_success 'am --keep-non-patch really keeps the non-patch part' ' - rm -fr .git/rebase-apply && - git reset --hard && - git checkout HEAD^ && + setup_temporary_branch master2^ && git am --keep-non-patch patch4 && test_path_is_missing .git/rebase-apply && git cat-file commit HEAD >actual && @@ -275,9 +273,7 @@ test_expect_success 'am --keep-non-patch really keeps the non-patch part' ' ' test_expect_success 'am -3 falls back to 3-way merge' ' - rm -fr .git/rebase-apply && - git reset --hard && - git checkout -b lorem2 master2 && + setup_fixed_branch lorem2 master2 && sed -n -e "3,\$p" msg >file && head -n 9 msg >>file && git add file && @@ -289,9 +285,7 @@ test_expect_success 'am -3 falls back to 3-way merge' ' ' test_expect_success 'am -3 -p0 can read --no-prefix patch' ' - rm -fr .git/rebase-apply && - git reset --hard && - git checkout -b lorem3 master2 && + setup_temporary_branch lorem2 && sed -n -e "3,\$p" msg >file && head -n 9 msg >>file && git add file && @@ -303,10 +297,8 @@ test_expect_success 'am -3 -p0 can read --no-prefix patch' ' ' test_expect_success 'am can rename a file' ' + setup_temporary_branch lorem && grep "^rename from" rename.patch && - rm -fr .git/rebase-apply && - git reset --hard && - git checkout lorem^0 && git am rename.patch && test_path_is_missing .git/rebase-apply && git update-index --refresh && @@ -314,10 +306,8 @@ test_expect_success 'am can rename a file' ' ' test_expect_success 'am -3 can rename a file' ' + setup_temporary_branch lorem && grep "^rename from" rename.patch && - rm -fr .git/rebase-apply && - git reset --hard && - git checkout lorem^0 && git am -3 rename.patch && test_path_is_missing .git/rebase-apply && git update-index --refresh && @@ -325,10 +315,8 @@ test_expect_success 'am -3 can rename a file' ' ' test_expect_success 'am -3 can rename a file after falling back to 3-way merge
[PATCH 2/3] t4150-am: refactor am -3 tests
Move the creation of the file, commit and branch used in git am -3 tests in a setup test, to avoid creating this setup several time. Signed-off-by: Remi Lespinet --- t/t4150-am.sh | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 8370951..8f85098 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -272,13 +272,17 @@ test_expect_success 'am --keep-non-patch really keeps the non-patch part' ' grep "^\[foo\] third" actual ' +test_expect_success 'setup: am -3' ' + setup_fixed_branch lorem2 master2 && + sed -n -e "3,\$p" msg >file && + head -n 9 msg >>file && + git add file && + test_tick && + git commit -m "copied stuff" +' + test_expect_success 'am -3 falls back to 3-way merge' ' + setup_temporary_branch lorem2 && - setup_fixed_branch lorem2 master2 && - sed -n -e "3,\$p" msg >file && - head -n 9 msg >>file && - git add file && - test_tick && - git commit -m "copied stuff" && git am -3 lorem-move.patch && test_path_is_missing .git/rebase-apply && git diff --exit-code lorem @@ -286,11 +290,6 @@ test_expect_success 'am -3 falls back to 3-way merge' ' test_expect_success 'am -3 -p0 can read --no-prefix patch' ' setup_temporary_branch lorem2 && - sed -n -e "3,\$p" msg >file && - head -n 9 msg >>file && - git add file && - test_tick && - git commit -m "copied stuff" && git am -3 -p0 lorem-zero.patch && test_path_is_missing .git/rebase-apply && git diff --exit-code lorem @@ -325,11 +324,6 @@ test_expect_success 'am -3 can rename a file after falling back to 3-way merge' test_expect_success 'am -3 -q is quiet' ' setup_temporary_branch lorem2 && - sed -n -e "3,\$p" msg >file && - head -n 9 msg >>file && - git add file && - test_tick && - git commit -m "copied stuff" && git am -3 -q lorem-move.patch >output.out 2>&1 && ! test -s output.out ' -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] git-am: add am.threeWay config variable
Add the am.threeWay configuration variable to use the -3 or --3way option of git am by default. When am.threeway is set and not desired for a specific git am command, the --no-3way option can be used to override it. Signed-off-by: Remi Lespinet --- Even if git am will be rewritten soon, the code that will have to be ported is not the most important part of the patch and the tests and documentation parts can be reused. Documentation/config.txt | 7 +++ Documentation/git-am.txt | 6 -- git-am.sh| 7 +++ t/t4150-am.sh| 15 +++ 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index d44bc85..8e42752 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -769,6 +769,13 @@ am.keepcr:: by giving '--no-keep-cr' from the command line. See linkgit:git-am[1], linkgit:git-mailsplit[1]. +am.threeWay:: + If true, git-am will fall back on 3-way merge when the patch + cannot be applied cleanly, in the same way as the '-3' or + '--3-way' option. Can be overridden by giving '--no-3-way' + from the command line. + See linkgit:git-am[1]. + apply.ignoreWhitespace:: When set to 'change', tells 'git apply' to ignore changes in whitespace, in the same way as the '--ignore-space-change' diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt index 0d8ba48..3190c05 100644 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@ -89,11 +89,13 @@ default. You can use `--no-utf8` to override this. linkgit:git-mailinfo[1]). -3:: ---3way:: +--[no-]3way:: When the patch does not apply cleanly, fall back on 3-way merge if the patch records the identity of blobs it is supposed to apply to and we have those blobs - available locally. + available locally. `am.threeWay` configuration variable + can be used to specify the default behaviour. `--no-3way` + is useful to override `am.threeWay`. --ignore-space-change:: --ignore-whitespace:: diff --git a/git-am.sh b/git-am.sh index 761befb..781507c 100755 --- a/git-am.sh +++ b/git-am.sh @@ -389,6 +389,11 @@ then keepcr=t fi +if test "$(git config --bool --get am.threeWay)" = true +then +threeway=t +fi + while test $# != 0 do case "$1" in @@ -400,6 +405,8 @@ it will be removed. Please do not use it anymore." ;; -3|--3way) threeway=t ;; + --no-3way) + threeway=f ;; -s|--signoff) sign=t ;; -u|--utf8) diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 8f85098..e16ef0e 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -288,6 +288,21 @@ test_expect_success 'am -3 falls back to 3-way merge' ' git diff --exit-code lorem ' +test_expect_success 'am with config am.threeWay falls back to 3-way merge' ' + setup_temporary_branch lorem2 && + test_config am.threeWay 1 && + git am lorem-move.patch && + test_path_is_missing .git/rebase-apply && + git diff --exit-code lorem +' + +test_expect_success 'am with config am.threeWay overridden by --no-3way' ' + setup_temporary_branch lorem2 && + test_config am.threeWay 1 && + test_must_fail git am --no-3way lorem-move.patch && + test_path_is_dir .git/rebase-apply +' + test_expect_success 'am -3 -p0 can read --no-prefix patch' ' setup_temporary_branch lorem2 && git am -3 -p0 lorem-zero.patch && -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC] send-email: allow multiple emails using --cc --to and --bcc
Hello, I've corrected an old patch from an Ensimag student. (http://thread.gmane.org/gmane.comp.version-control.git/228182). This patch allows multiple email addresses for options --cc, --to and --bcc. As said in the commit message, this patch doesn't handle commas in name, and the only possibility for using commas in name is to use the rfc2047 syntax: To: =?ISO-8859-1?Q?Ex=2C_ample?= I would like to add the possibility to use the following command lines: git send-email --to '"Ex, am ple" ' git send-email --to '"Ex, am" "ple" ' git send-email --to "\"Ex, am ple\" " git send-email --to "\"Ex, am\" \"ple\" " Here are my questions : Is this a good idea to handle commas in name ? Do you have any suggestion about proposed syntaxes ? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC] send-email: allow multiple emails using --cc --to and --bcc
From: Jorge Juan Garcia Garcia Add the possibility to use a list of emails separated by commas in flags --cc --to and --bcc instead of having to use one flag per email address. The use-case is to copy-paste a list of addresses from an email. This change makes it so that we no longer need to cut the list. The format of email list handled is basic for now: $ git send-email --to='Foo , b...@example.com' We thought it would be nice to have a "first-step" version which works before handling more complex ones such as names with commas: $ git send-email --to='Foo, Bar ' This artificial limitation is imposed by 79ee555b (Check and document the options to prevent mistakes, 2006-06-21). Signed-off-by: Mathieu Lienard--Mayor Signed-off-by: Jorge Juan Garcia Garcia Signed-off-by: Matthieu Moy Contributions-by: Remi Lespinet --- Documentation/git-send-email.txt | 23 ++ git-send-email.perl | 21 ++-- t/t9001-send-email.sh| 41 3 files changed, 58 insertions(+), 27 deletions(-) diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index 043f345..0aeddcb 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -49,17 +49,21 @@ Composing of 'sendemail.annotate'. See the CONFIGURATION section for 'sendemail.multiEdit'. ---bcc=:: +--bcc="[,...]":: Specify a "Bcc:" value for each email. Default is the value of 'sendemail.bcc'. -+ -The --bcc option must be repeated for each user you want on the bcc list. + The format supported for email list is the following: + "Foo , b...@example.com". + Please notice that the email list does not handle commas in + email names such as "Foo, Bar ". ---cc=:: +--cc="[,...]":: Specify a starting "Cc:" value for each email. Default is the value of 'sendemail.cc'. -+ -The --cc option must be repeated for each user you want on the cc list. + The format supported for email list is the following: + "Foo , b...@example.com". + Please notice that the email list does not handle commas in + email names such as "Foo, Bar ". --compose:: Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1]) @@ -111,12 +115,15 @@ is not set, this will be prompted for. is not set, this will be prompted for. --to=:: +--to="[,...]":: Specify the primary recipient of the emails generated. Generally, this will be the upstream maintainer of the project involved. Default is the value of the 'sendemail.to' configuration value; if that is unspecified, and --to-cmd is not specified, this will be prompted for. -+ -The --to option must be repeated for each user you want on the to list. + The format supported for email list is the following: + "Foo , b...@example.com". + Please notice that the email list does not handle commas in + email names such as "Foo, Bar ". --8bit-encoding=:: When encountering a non-ASCII message or subject that does not diff --git a/git-send-email.perl b/git-send-email.perl index ffea500..409ff45 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -460,20 +460,6 @@ my ($repoauthor, $repocommitter); ($repoauthor) = Git::ident_person(@repo, 'author'); ($repocommitter) = Git::ident_person(@repo, 'committer'); -# Verify the user input - -foreach my $entry (@initial_to) { - die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/; -} - -foreach my $entry (@initial_cc) { - die "Comma in --cc entry: $entry'\n" unless $entry !~ m/,/; -} - -foreach my $entry (@bcclist) { - die "Comma in --bcclist entry: $entry'\n" unless $entry !~ m/,/; -} - sub parse_address_line { if ($have_mail_address) { return map { $_->format } Mail::Address->parse($_[0]); @@ -1052,7 +1038,8 @@ sub sanitize_address { } sub sanitize_address_list { - return (map { sanitize_address($_) } @_); + my @addr_list = split_address_list(@_); + return (map { sanitize_address($_) } @addr_list); } # Returns the local Fully Qualified Domain Name (FQDN) if available. @@ -1193,6 +1180,10 @@ sub file_name_is_absolute { return File::Spec::Functions::file_name_is_absolute($path); } +sub split_address_list { + return (map { split /\s*,\s*/, $_ } @_); +} + # Returns 1 if the message was sent, and 0 otherwise. # In actuality, the whole program dies when there # is an error sending a message. diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index a3663da..4245c06 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-se
[PATCH 1/3] t4150-am: refactor and clean common setup
Eric Sunshine writes: > Paul Tan writes: > > >> Remi LESPINET writes: > >> + tmp_name=${2-"temporary"} > > > > I don't think the quotes are required. Also, I don't feel good about > > swapping the order of the arguments to git-checkout. (or making $2 an > > optional argument). As the patch stands, if I see > > > > setup_temporary_branch lorem > > > > I will think: so we are creating a temporary branch "lorem". But nope, > > we are creating a temporary branch "temporary" that branches from > > "lorem". I don't think writing setup_temporary_branch "temporary" > > "lorem" explicitly is that bad. > > In fact, the second argument is never used in any of the three > patches, so it seems to be wasted functionality (at this time). If so, > then an even more appropriate name might be new_temp_branch_from(). > Clearly, then: > > new_temp_branch_from lorem Considering your two comments about the name of the function I think removing the possibility of using the second argument and renaming the function new_temp_branch_from gets everyone to agree since it has not the possible confusion with git-checkout problem. > This is confusing. The commit message seems to advertise this patch as > primarily a refactoring change (pulling boilerplate out of tests and > into a new function), but the operation of that new function is > surprisingly different from the boilerplate it's replacing: The old > code did not create a branch, the new function does. > > If your intention really is to create new branches in tests which > previously did not need throwaway branches, then the commit message > should state that as its primary purpose and explain why doing so is > desirable, since it is not clear from this patch what you gain from > doing so. > > Moreover, typically, you should only either refactor or change > behavior in a single patch, not both. For instance, patch 1 would add > the new function and update tests to call it in place of the > boilerplate; and patch 2 would change behavior (such as creating a > temporary branch). > > On the other hand, if these tests really don't benefit from having a > throw-away branch, then this change seems suspect and obscures the > intent of the test rather than clarifying or simplifying. The purpose of this patch was originally to eliminate some test dependancies introduced by the checkouts relative to HEAD (which caused "cascade failure") and avoid creating branches, whose name can't be reused, but you're right, that may not benefit as much as I expected... Perhaps I should have make tags from branches used as start points, which would have done the same effect as these temporary branches. > > sed -n -e "3,\$p" msg >file && > > head -n 9 msg >>file && > > git add file && > > @@ -303,10 +297,8 @@ test_expect_success 'am -3 -p0 can read --no-prefix > > patch' ' > > ' > > > > test_expect_success 'am can rename a file' ' > > + setup_temporary_branch lorem && > > grep "^rename from" rename.patch && > > - rm -fr .git/rebase-apply && > > - git reset --hard && > > - git checkout lorem^0 && > > In other cases, you insert the setup_temporary_branch() invocation > where the old code resided. Why the difference in this test (and > others following)? This doesn't affect the result of the test (assuming setup_temporary_branch doesn't fail). I preferred to add the setup before anything else in the test. It affects efficiency in case the rename patch has not the correct syntax. So it may be better to put the grep as the first instruction to avoid evaluating all the test in case the syntax of the patch is not correct. Thanks a lot for your comments, I'll correct the patch asap ! -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC] send-email: allow multiple emails using --cc --to and --bcc
Junio C Hamano writes: > Remi Lespinet writes: > Accept a list of emails separated by commas in flags --cc, --to > and --bcc. Multiple addresses can already be given by using > these options multiple times, but it is more convenient to allow > cutting-and-pasting a list of addresses from the header of an > existing e-mail message, which already lists them as > comma-separated list, as a value to a single parameter. > > perhaps? I've taken this description for the first part of the commit message. Thanks! > > before handling more complex ones such as names with commas: > > $ git send-email --to='Foo, Bar ' > > Shouldn't this example send to two users, i.e. a local user Foo and > the mailbox 'foobar' at example.com whose human-readable name is > Bar? If so, that is a bad example to illustrate the aspiration for > the finished patch? Yes, that works if Foo is in an alias file, so that's clearly a bad example, I added quotes: git send-email --to='"Foo, Bar" ' Thanks! -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC] send-email: allow multiple emails using --cc --to and --bcc
Eric Sunshine writes: > wrote: > > validate_address_list(sanitize_address_list( > split_address_list(@xx)) > > That's pretty verbose, so introducing a new function to encapsulates > that behavior might be reasonable. Agreed, If you have any suggestion for the name of this function, I'll be happy to use it, I named it extract_address_list, but I'm not sure that it's a good name. Thanks again for the review! -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] send-email: allow multiple emails using --cc, --to and --bcc
Accept a list of emails separated by commas in flags --cc, --to and --bcc. Multiple addresses can already be given by using these options multiple times, but it is more convenient to allow cutting-and-pasting a list of addresses from the header of an existing e-mail message, which already lists them as comma-separated list, as a value to a single parameter. The following format can now be used: $ git send-email --to='Jane , m...@example.com' However format using commas in names doesn't work: $ git send-email --to='"Jane, Doe" ' Remove the limitation imposed by 79ee555b (Check and document the options to prevent mistakes, 2006-06-21) which rejected every argument with comma in --cc, --to and --bcc Helped-by: Remi Lespinet Signed-off-by: Mathieu Lienard--Mayor Signed-off-by: Jorge Juan Garcia Garcia Signed-off-by: Matthieu Moy Signed-off-by: Remi Lespinet --- Documentation/git-send-email.txt | 21 +++-- git-send-email.perl | 33 ++--- t/t9001-send-email.sh| 30 ++ 3 files changed, 59 insertions(+), 25 deletions(-) diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index 043f345..f862fa6 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -49,17 +49,23 @@ Composing of 'sendemail.annotate'. See the CONFIGURATION section for 'sendemail.multiEdit'. ---bcc=:: +--bcc=,...:: Specify a "Bcc:" value for each email. Default is the value of 'sendemail.bcc'. + -The --bcc option must be repeated for each user you want on the bcc list. +Addresses containing commas ("Foo, Bar" ) are not +currently supported. ++ +This option may be specified multiple times ---cc=:: +--cc=,...:: Specify a starting "Cc:" value for each email. Default is the value of 'sendemail.cc'. + -The --cc option must be repeated for each user you want on the cc list. +Addresses containing commas ("Foo, Bar" ) are not +currently supported. ++ +This option may be specified multiple times --compose:: Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1]) @@ -110,13 +116,16 @@ is not set, this will be prompted for. Only necessary if --compose is also set. If --compose is not set, this will be prompted for. ---to=:: +--to=,...:: Specify the primary recipient of the emails generated. Generally, this will be the upstream maintainer of the project involved. Default is the value of the 'sendemail.to' configuration value; if that is unspecified, and --to-cmd is not specified, this will be prompted for. + -The --to option must be repeated for each user you want on the to list. +Addresses containing commas ("Foo, Bar" ) are not +currently supported. ++ +This option may be specified multiple times --8bit-encoding=:: When encountering a non-ASCII message or subject that does not diff --git a/git-send-email.perl b/git-send-email.perl index ffea500..389f19c 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -460,20 +460,6 @@ my ($repoauthor, $repocommitter); ($repoauthor) = Git::ident_person(@repo, 'author'); ($repocommitter) = Git::ident_person(@repo, 'committer'); -# Verify the user input - -foreach my $entry (@initial_to) { - die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/; -} - -foreach my $entry (@initial_cc) { - die "Comma in --cc entry: $entry'\n" unless $entry !~ m/,/; -} - -foreach my $entry (@bcclist) { - die "Comma in --bcclist entry: $entry'\n" unless $entry !~ m/,/; -} - sub parse_address_line { if ($have_mail_address) { return map { $_->format } Mail::Address->parse($_[0]); @@ -838,11 +824,11 @@ sub expand_one_alias { } @initial_to = expand_aliases(@initial_to); -@initial_to = validate_address_list(sanitize_address_list(@initial_to)); +@initial_to = extract_address_list(@initial_to); @initial_cc = expand_aliases(@initial_cc); -@initial_cc = validate_address_list(sanitize_address_list(@initial_cc)); +@initial_cc = extract_address_list(@initial_cc); @bcclist = expand_aliases(@bcclist); -@bcclist = validate_address_list(sanitize_address_list(@bcclist)); +@bcclist = extract_address_list(@bcclist); if ($thread && !defined $initial_reply_to && $prompting) { $initial_reply_to = ask( @@ -1055,6 +1041,15 @@ sub sanitize_address_list { return (map { sanitize_address($_) } @_); } +sub split_address_list_items { + return (map { split /\s*,\s*/, $_ } @_); +} + +sub extract_address_list { + return validate_address_list(sanitize_address_list( + split_address_list_items(@_))); +} + # Returns the local Full
[PATCH 1/2] t9001-send-email: create a function replacing variable fields
Create a function which replaces Date, Message-Id and X-Mailer lines generated by git-send-email by a specific string Date:.*$ -> Date: DATE-STRING Message-Id:.*$ -> Message-Id: MESSAGE-ID-STRING X-Mailer:.*$ -> X-Mailer: X-MAILER-STRING This is a preparatory for the next commit which uses this function Signed-off-by: Remi Lespinet --- t/t9001-send-email.sh | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index a3663da..71968ee 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -519,6 +519,12 @@ Result: OK EOF " +replace_variable_fields () { + sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \ + -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ + -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" +} + test_suppression () { git send-email \ --dry-run \ @@ -526,10 +532,7 @@ test_suppression () { --from="Example " \ --to=t...@example.com \ --smtp-server relay.example.com \ - $patches | - sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \ - -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ - -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \ + $patches | replace_variable_fields \ >actual-suppress-$1${2+"-$2"} && test_cmp expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"} } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC] solving a bug with hunks starting at line 1 in git apply
== = 1. The bug == hunks of the form: @@ -1,k +n,m @@ have a special behavior because of the variable match_begining. For these hunks, offset is not allowed which means that the fragment has to match at the first line of the image. This is done for the sake of safety (This behavior does not exist in the basic patch command). Here's an example first original file: 10 20 30 40 for the following diff file: @@ -1,2 +1,2 @@ 20 -30 +35 40 The patch will not be applied with a git apply command, but it will with a basic patch command. However, there's no problem with the following diff for both: @@ -2,2 +2,2 @@ 10 -20 +25 30 The problem comes when we have a diff file like that (which can be obtained by splitting a hunk with git add -p for example (unsolved bug reported in 1bf01040f0c1101f410f9caa5e715460cdd0cbe0)) @@ -1,1 +1,2 @@ +5 10 @@ -1,3 +2,3 @@ 10 +15 -20 30 In this case the first hunk will be treated, the image will then become 5 10 20 30 The second will try to match the lines 10 20 30 with the first lines of the image, will not succeed and will return that it is not possible without trying to match the image with offsets, because the hunk begin with 1. Moreover, there are cases where both the git apply and the patch command will work, giving different outputs. second original file: 10 10 20 diff file associated: @@ -1,1 +1,2 @@ +10 10 @@ -1,2 +2,3 @@ 10 +cc 10 With git apply, the problem will silently appear, and the command will give the following output: 10 cc 10 10 20 whereas the output given by the simple patch command will be: 10 10 cc 10 20 == = 2. Correction == I see mainly two ways to fix the bug: * 2.1 first method (the most basic) The most basic is to change the code so that the special behavior only affects the hunks of the form @@ -1,k +1,m @@ Which makes the previous diff file possible to use. And fixes the bug reported in 1bf01040f0c1101f410f9caa5e715460cdd0cbe0 Note that this modification, which changes positively behavior of hunks @@ -1,k +l,m @@ where l is not 1, when there's a hunk @@ -1,a +1,b @@ above, also changes the behavior when there's no such bloc above: For example: the diff file @@ -1,2 +2,2 @@ 20 -30 +35 40 would have given an error before this patch (with the first original file) whereas it works with the modification introduced by the patch. ** * 2.2 second method ** The other method, is to pass a base_line and an offset to the match_fragment function instead of passing directly the line to test. This does not involve any change in the behavior of apply, and therefore has not the problem of the most basic method. == = 3. Question == I personnaly think that the second method is better, but this implies more modifications, and it will be useful only to keep the failing behavior of some hand-modified patches... Do you think that the second method is worth implementing ? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] solving a bug with hunks starting at line 1 in git apply
Ok, Thanks for all the informations > Notice that the pre-context lines in this second example is only one > line. Is it giving the same degree of safety if we rejected an > attempt to apply this patch only when the original does not have 10, > 20, 30 and 40 in this order? > > No. Because we are doing two-line context patch, the patch is not > just saying "this change applies to a place where the first line is > 10". It also is saying "there is no line before that line". Yes, It's obvious that "patch" has not the same degree of safety as the git apply command. But I thought that any patch working with git apply should work with the "patch" command and give the same output, It seems that this is not true, regarding file: 10 10 10 10 20 diff: @@ -1,2 +1,3 @@ +10 10 10 @@ -1,4 +2,5 @@ 10 10 +cc 10 10 (I changed it to have 2 line context). Of course these are hand-written patches, which can't be obtained with a diff (except with the non coalescing git add -p as you said yourself). Wouldn't it be a problem? > In other words, isn't the right fix to coalesce that input, so that > the second hunk does *not* require fuzzy application in the first > place? Yes, you're right, that will be fixed if we restore coalescing, I didn't thought of this possibility. This will cause fewer split but we have the edit option anyway. Thanks -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v2 2/2] git-am: add am.threeWay config variable
Add the am.threeWay configuration variable to use the -3 or --3way option of git am by default. When am.threeway is set and not desired for a specific git am command, the --no-3way option can be used to override it. Signed-off-by: Remi Lespinet --- Documentation/config.txt | 7 +++ Documentation/git-am.txt | 6 -- git-am.sh| 7 +++ t/t4150-am.sh| 19 +++ 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index d44bc85..8e42752 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -769,6 +769,13 @@ am.keepcr:: by giving '--no-keep-cr' from the command line. See linkgit:git-am[1], linkgit:git-mailsplit[1]. +am.threeWay:: + If true, git-am will fall back on 3-way merge when the patch + cannot be applied cleanly, in the same way as the '-3' or + '--3-way' option. Can be overridden by giving '--no-3-way' + from the command line. + See linkgit:git-am[1]. + apply.ignoreWhitespace:: When set to 'change', tells 'git apply' to ignore changes in whitespace, in the same way as the '--ignore-space-change' diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt index 0d8ba48..3190c05 100644 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@ -89,11 +89,13 @@ default. You can use `--no-utf8` to override this. linkgit:git-mailinfo[1]). -3:: ---3way:: +--[no-]3way:: When the patch does not apply cleanly, fall back on 3-way merge if the patch records the identity of blobs it is supposed to apply to and we have those blobs - available locally. + available locally. `am.threeWay` configuration variable + can be used to specify the default behaviour. `--no-3way` + is useful to override `am.threeWay`. --ignore-space-change:: --ignore-whitespace:: diff --git a/git-am.sh b/git-am.sh index 761befb..781507c 100755 --- a/git-am.sh +++ b/git-am.sh @@ -389,6 +389,11 @@ then keepcr=t fi +if test "$(git config --bool --get am.threeWay)" = true +then +threeway=t +fi + while test $# != 0 do case "$1" in @@ -400,6 +405,8 @@ it will be removed. Please do not use it anymore." ;; -3|--3way) threeway=t ;; + --no-3way) + threeway=f ;; -s|--signoff) sign=t ;; -u|--utf8) diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 6ced98c..b822a39 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -303,6 +303,25 @@ test_expect_success 'am -3 -p0 can read --no-prefix patch' ' git diff --exit-code lorem ' +test_expect_success 'am with config am.threeWay falls back to 3-way merge' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout -b lorem4 base3way && + test_config am.threeWay 1 && + git am lorem-move.patch && + test_path_is_missing .git/rebase-apply && + git diff --exit-code lorem +' + +test_expect_success 'am with config am.threeWay overridden by --no-3way' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout -b lorem5 base3way && + test_config am.threeWay 1 && + test_must_fail git am --no-3way lorem-move.patch && + test_path_is_dir .git/rebase-apply +' + test_expect_success 'am can rename a file' ' grep "^rename from" rename.patch && rm -fr .git/rebase-apply && -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v2 1/2] t4150-am: refactor am -3 tests
Create a setup for git am -3 in a separate test instead of creating this setup each time. This prepares for the next commit which will use this setup as well. Signed-off-by: Remi Lespinet --- I removed the function creating temporary branch for now, because this would have cost too much time reviewing. I've just done a refactoring to simplify changes introduced in the next commit. t/t4150-am.sh | 32 ++-- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 306e6f3..6ced98c 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -274,15 +274,21 @@ test_expect_success 'am --keep-non-patch really keeps the non-patch part' ' grep "^\[foo\] third" actual ' +test_expect_success 'setup am -3' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout -b base3way master2 && + sed -n -e "3,\$p" msg >file && + head -n 9 msg >>file && + git add file && + test_tick && + git commit -m "copied stuff" +' + test_expect_success 'am -3 falls back to 3-way merge' ' rm -fr .git/rebase-apply && git reset --hard && - git checkout -b lorem2 master2 && - sed -n -e "3,\$p" msg >file && - head -n 9 msg >>file && - git add file && - test_tick && - git commit -m "copied stuff" && + git checkout -b lorem2 base3way && git am -3 lorem-move.patch && test_path_is_missing .git/rebase-apply && git diff --exit-code lorem @@ -291,12 +297,7 @@ test_expect_success 'am -3 falls back to 3-way merge' ' test_expect_success 'am -3 -p0 can read --no-prefix patch' ' rm -fr .git/rebase-apply && git reset --hard && - git checkout -b lorem3 master2 && - sed -n -e "3,\$p" msg >file && - head -n 9 msg >>file && - git add file && - test_tick && - git commit -m "copied stuff" && + git checkout -b lorem3 base3way && git am -3 -p0 lorem-zero.patch && test_path_is_missing .git/rebase-apply && git diff --exit-code lorem @@ -338,12 +339,7 @@ test_expect_success 'am -3 can rename a file after falling back to 3-way merge' test_expect_success 'am -3 -q is quiet' ' rm -fr .git/rebase-apply && git checkout -f lorem2 && - git reset master2 --hard && - sed -n -e "3,\$p" msg >file && - head -n 9 msg >>file && - git add file && - test_tick && - git commit -m "copied stuff" && + git reset base3way --hard && git am -3 -q lorem-move.patch >output.out 2>&1 && ! test -s output.out ' -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v2 2/2] git-am: add am.threeWay config variable
Matthieu Moy writes: > Remi Lespinet writes: > > > +if test "$(git config --bool --get am.threeWay)" = true > > +then > > +threeway=t > > +fi > > I think you missed Paul's remark on this: > > http://article.gmane.org/gmane.comp.version-control.git/270150 > > Not terribly important since am will be rewritten soon, though. Oh right, sorry about that, I modify it and I resend the patch asap -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v3 1/4] git-am.sh: fix initialization of the threeway variable
Initialization for the threeway variable was missing. This caused a behavior change for command lines like: threeway=t git am ... This commit fixes the bug. Signed-off-by: Remi Lespinet --- git-am.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/git-am.sh b/git-am.sh index 761befb..c460dd0 100755 --- a/git-am.sh +++ b/git-am.sh @@ -378,6 +378,7 @@ committer_date_is_author_date= ignore_date= allow_rerere_autoupdate= gpg_sign_opt= +threeway= if test "$(git config --bool --get am.messageid)" = true then -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v3 4/4] git-am: add am.threeWay config variable
Add the am.threeWay configuration variable to use the -3 or --3way option of git am by default. When am.threeway is set and not desired for a specific git am command, the --no-3way option can be used to override it. Signed-off-by: Remi Lespinet --- Even if git am will be rewritten soon, the code that will have to be ported is not the most important part of the patch and the tests and documentation parts can be reused. Documentation/config.txt | 8 Documentation/git-am.txt | 11 ++- git-am.sh| 9 + t/t4150-am.sh| 19 +++ 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index d44bc85..669f5fc 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -769,6 +769,14 @@ am.keepcr:: by giving '--no-keep-cr' from the command line. See linkgit:git-am[1], linkgit:git-mailsplit[1]. +am.threeWay:: + By default, git-am will fail if the patch does not apply cleanly. When + set to true, this setting tells git-am to fall back on 3-way merge if + the patch records the identity of blobs it is supposed to apply to and + we have those blobs available locally (equivalent to giving the --3way + option from the command line). + See linkgit:git-am[1]. + apply.ignoreWhitespace:: When set to 'change', tells 'git apply' to ignore changes in whitespace, in the same way as the '--ignore-space-change' diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt index d412f6b..0472182 100644 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@ -10,7 +10,7 @@ SYNOPSIS [verse] 'git am' [--signoff] [--keep] [--[no-]keep-cr] [--[no-]utf8] -[--3way] [--interactive] [--committer-date-is-author-date] +[--[no-]3way] [--interactive] [--committer-date-is-author-date] [--ignore-date] [--ignore-space-change | --ignore-whitespace] [--whitespace=] [-C] [-p] [--directory=] [--exclude=] [--include=] [--reject] [-q | --quiet] @@ -34,6 +34,14 @@ am.keepcr:: by giving '--no-keep-cr' from the command line. See linkgit:git-am[1], linkgit:git-mailsplit[1]. +am.threeWay:: + By default, git-am will fail if the patch does not apply cleanly. When + set to true, this setting tells git-am to fall back on 3-way merge if + the patch records the identity of blobs it is supposed to apply to and + we have those blobs available locally (equivalent to giving the --3way + option from the command line). + See linkgit:git-am[1]. + OPTIONS --- (|)...:: @@ -100,6 +108,7 @@ default. You can use `--no-utf8` to override this. -3:: --3way:: +--no-3way:: When the patch does not apply cleanly, fall back on 3-way merge if the patch records the identity of blobs it is supposed to apply to and we have those blobs diff --git a/git-am.sh b/git-am.sh index c460dd0..75e701a 100755 --- a/git-am.sh +++ b/git-am.sh @@ -390,6 +390,11 @@ then keepcr=t fi +if test "$(git config --bool --get am.threeWay)" = true +then +threeway=t +fi + while test $# != 0 do case "$1" in @@ -401,6 +406,8 @@ it will be removed. Please do not use it anymore." ;; -3|--3way) threeway=t ;; + --no-3way) + threeway=f ;; -s|--signoff) sign=t ;; -u|--utf8) @@ -658,6 +665,8 @@ fi if test "$(cat "$dotest/threeway")" = t then threeway=t +else + threeway=f fi git_apply_opt=$(cat "$dotest/apply-opt") if test "$(cat "$dotest/sign")" = t diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 6ced98c..b822a39 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -303,6 +303,25 @@ test_expect_success 'am -3 -p0 can read --no-prefix patch' ' git diff --exit-code lorem ' +test_expect_success 'am with config am.threeWay falls back to 3-way merge' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout -b lorem4 base3way && + test_config am.threeWay 1 && + git am lorem-move.patch && + test_path_is_missing .git/rebase-apply && + git diff --exit-code lorem +' + +test_expect_success 'am with config am.threeWay overridden by --no-3way' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout -b lorem5 base3way && + test_config am.threeWay 1 && + test_must_fail git am --no-3way lorem-move.patch && + test_path_is_dir .git/rebase-apply +' + test_expect_success 'am can rename a file' ' grep "^rename from" rename.patch && rm -fr .git/rebase-apply && -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v3 2/4] git-am.txt: add configuration section in git am documentation
Prepare a configuration section for the git am documentation. Remove the part related to the am.keepcr configuration variable in the description of the --keepcr option and place the description of the am.keepcr configuration variable in the newly created configuration section. This section will be used in the next commit. Signed-off-by: Remi Lespinet --- Documentation/git-am.txt | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt index 0d8ba48..d412f6b 100644 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@ -24,6 +24,16 @@ Splits mail messages in a mailbox into commit log message, authorship information and patches, and applies them to the current branch. +CONFIGURATION +- + +am.keepcr:: + If true, git-am will call git-mailsplit for patches in mbox format + with parameter '--keep-cr'. In this case git-mailsplit will + not remove `\r` from lines ending with `\r\n`. Can be overridden + by giving '--no-keep-cr' from the command line. + See linkgit:git-am[1], linkgit:git-mailsplit[1]. + OPTIONS --- (|)...:: @@ -43,11 +53,11 @@ OPTIONS --keep-non-patch:: Pass `-b` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]). ---[no-]keep-cr:: +--keep-cr:: +--no-keep-cr:: With `--keep-cr`, call 'git mailsplit' (see linkgit:git-mailsplit[1]) with the same option, to prevent it from stripping CR at the end of - lines. `am.keepcr` configuration variable can be used to specify the - default behaviour. `--no-keep-cr` is useful to override `am.keepcr`. + lines. -c:: --scissors:: -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v3 3/4] t4150-am: refactor am -3 tests
Create a setup for git am -3 in a separate test instead of creating this setup each time. This prepares for the next commit which will use this setup as well. Signed-off-by: Remi Lespinet --- t/t4150-am.sh | 32 ++-- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 306e6f3..6ced98c 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -274,15 +274,21 @@ test_expect_success 'am --keep-non-patch really keeps the non-patch part' ' grep "^\[foo\] third" actual ' +test_expect_success 'setup am -3' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout -b base3way master2 && + sed -n -e "3,\$p" msg >file && + head -n 9 msg >>file && + git add file && + test_tick && + git commit -m "copied stuff" +' + test_expect_success 'am -3 falls back to 3-way merge' ' rm -fr .git/rebase-apply && git reset --hard && - git checkout -b lorem2 master2 && - sed -n -e "3,\$p" msg >file && - head -n 9 msg >>file && - git add file && - test_tick && - git commit -m "copied stuff" && + git checkout -b lorem2 base3way && git am -3 lorem-move.patch && test_path_is_missing .git/rebase-apply && git diff --exit-code lorem @@ -291,12 +297,7 @@ test_expect_success 'am -3 falls back to 3-way merge' ' test_expect_success 'am -3 -p0 can read --no-prefix patch' ' rm -fr .git/rebase-apply && git reset --hard && - git checkout -b lorem3 master2 && - sed -n -e "3,\$p" msg >file && - head -n 9 msg >>file && - git add file && - test_tick && - git commit -m "copied stuff" && + git checkout -b lorem3 base3way && git am -3 -p0 lorem-zero.patch && test_path_is_missing .git/rebase-apply && git diff --exit-code lorem @@ -338,12 +339,7 @@ test_expect_success 'am -3 can rename a file after falling back to 3-way merge' test_expect_success 'am -3 -q is quiet' ' rm -fr .git/rebase-apply && git checkout -f lorem2 && - git reset master2 --hard && - sed -n -e "3,\$p" msg >file && - head -n 9 msg >>file && - git add file && - test_tick && - git commit -m "copied stuff" && + git reset base3way --hard && git am -3 -q lorem-move.patch >output.out 2>&1 && ! test -s output.out ' -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v3 2/4] git-am.txt: add configuration section in git am documentation
> On 06/03/2015 07:50 AM Torsten Bögershausen wrote > > > +CONFIGURATION > > +- > > + > > +am.keepcr:: > > +If true, git-am will call git-mailsplit for patches in mbox format > > +with parameter '--keep-cr'. In this case git-mailsplit will > > +not remove `\r` from lines ending with `\r\n`. Can be overridden > > +by giving '--no-keep-cr' from the command line. > (This documentation assumes that am.keepcr is true) > Would it be clearer to put the "overridden" into one line and write like > this: > > Can be overridden by giving '--no-keep-cr' or '--keep-cr' from the command > line. Yes I agree, or maybe: '--keep-cr' and '--no-keep-cr' take precedence over this variable. Actually, I don't know if we need to write it (as Paul Tan suggested in the previous version of this patch for the threeway option http://article.gmane.org/gmane.comp.version-control.git/270150) I checked the documentation of different commands. From what I've seen, such indications either does not appear or are right after the text. I agree that it's a good idea, but for the sake of consistency, I'd rather use one of these two format as long as it's ok for you. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v3 4/4] git-am: add am.threeWay config variable
Matthieu Moy writes > Remi Lespinet writes: > > > +am.threeWay:: > > +By default, git-am will fail if the patch does not apply cleanly. > > http://article.gmane.org/gmane.comp.version-control.git/270538 Ok sorry. Thanks -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH/RFC v3 2/4] git-am.txt: add configuration section in git am documentation
Matthieu Moy writes > Most git-*.txt do not have this CONFIGURATION section. > > In an ideal world, we would have such section automatically generated > (i.e. the description for each variable would exist in one place, and we > would make sure that both "man git-config" and "man git-" show > it). In a really ideal world, it would also be propagated to the code > and we would have a "git config --describe am.keepcr" or so that would > return the doc. > > I'm a bit worried to see documentation cut-and-pasted from config.txt to > git-*.txt for maintainability: if the text on one side is modified, > we're likely to forget the other and the text will diverge with time. > > Not a strong objection, but I have the feeling that the more we do this > kind of patches, the harder it will be if ever we decide to do the above. I've seen occurences of this (mainly git-rebase.txt and git-grep), but I agree, I think I'll remove the configuration section. > > +CONFIGURATION > > +- > > + > > +am.keepcr:: > > +If true, git-am will call git-mailsplit for patches in mbox format > > `git am` > `git mailsplit` > > > +with parameter '--keep-cr'. In this case git-mailsplit will > > Likewise > > > +not remove `\r` from lines ending with `\r\n`. Can be overridden > > +by giving '--no-keep-cr' from the command line. > > That should be backquote, not forward-quote, right? > > I know it's not your code since it's a cut-and-paste from config.txt, > but that illustrates my point above: we used to have one place with > wrong quotes, and we'd have two after the patch. Ok I'll correct it in a minor patch -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH/RFC v3 2/4] git-am.txt: add configuration section in git am documentation
> Matthieu Moy writes > > > +CONFIGURATION > > > +- > > > + > > > +am.keepcr:: > > > +If true, git-am will call git-mailsplit for patches in mbox > > > format > > > > `git am` > > `git mailsplit` > > > > > +with parameter '--keep-cr'. In this case git-mailsplit will > > > > Likewise > > > > > +not remove `\r` from lines ending with `\r\n`. Can be overridden > > > +by giving '--no-keep-cr' from the command line. > > > > That should be backquote, not forward-quote, right? > > > > I know it's not your code since it's a cut-and-paste from config.txt, > > but that illustrates my point above: we used to have one place with > > wrong quotes, and we'd have two after the patch. > > Ok I'll correct it in a minor patch Actually I don't think that this is a good idea to correct that (since there's many occurences of forward-quoted options in git-config.txt). I'll just remove the configuration part in the git am documentation. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v4 3/3] git-am: add am.threeWay config variable
Add the am.threeWay configuration variable to use the -3 or --3way option of git am by default. When am.threeway is set and not desired for a specific git am command, the --no-3way option can be used to override it. Signed-off-by: Remi Lespinet --- Documentation/config.txt | 8 Documentation/git-am.txt | 7 +-- git-am.sh| 9 + t/t4150-am.sh| 19 +++ 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index d44bc85..36b75d9 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -769,6 +769,14 @@ am.keepcr:: by giving '--no-keep-cr' from the command line. See linkgit:git-am[1], linkgit:git-mailsplit[1]. +am.threeWay:: + By default, `git am` will fail if the patch does not apply cleanly. When + set to true, this setting tells `git am` to fall back on 3-way merge if + the patch records the identity of blobs it is supposed to apply to and + we have those blobs available locally (equivalent to giving the `--3way` + option from the command line). Defaults to `false`. + See linkgit:git-am[1]. + apply.ignoreWhitespace:: When set to 'change', tells 'git apply' to ignore changes in whitespace, in the same way as the '--ignore-space-change' diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt index 0d8ba48..d92b569 100644 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@ -10,7 +10,7 @@ SYNOPSIS [verse] 'git am' [--signoff] [--keep] [--[no-]keep-cr] [--[no-]utf8] -[--3way] [--interactive] [--committer-date-is-author-date] +[--[no-]3way] [--interactive] [--committer-date-is-author-date] [--ignore-date] [--ignore-space-change | --ignore-whitespace] [--whitespace=] [-C] [-p] [--directory=] [--exclude=] [--include=] [--reject] [-q | --quiet] @@ -90,10 +90,13 @@ default. You can use `--no-utf8` to override this. -3:: --3way:: +--no-3way:: When the patch does not apply cleanly, fall back on 3-way merge if the patch records the identity of blobs it is supposed to apply to and we have those blobs - available locally. + available locally. `--no-3way` can be used to override + am.threeWay configuration variable. For more information, + see am.threeWay in git-config(1). --ignore-space-change:: --ignore-whitespace:: diff --git a/git-am.sh b/git-am.sh index c460dd0..75e701a 100755 --- a/git-am.sh +++ b/git-am.sh @@ -390,6 +390,11 @@ then keepcr=t fi +if test "$(git config --bool --get am.threeWay)" = true +then +threeway=t +fi + while test $# != 0 do case "$1" in @@ -401,6 +406,8 @@ it will be removed. Please do not use it anymore." ;; -3|--3way) threeway=t ;; + --no-3way) + threeway=f ;; -s|--signoff) sign=t ;; -u|--utf8) @@ -658,6 +665,8 @@ fi if test "$(cat "$dotest/threeway")" = t then threeway=t +else + threeway=f fi git_apply_opt=$(cat "$dotest/apply-opt") if test "$(cat "$dotest/sign")" = t diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 6ced98c..b822a39 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -303,6 +303,25 @@ test_expect_success 'am -3 -p0 can read --no-prefix patch' ' git diff --exit-code lorem ' +test_expect_success 'am with config am.threeWay falls back to 3-way merge' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout -b lorem4 base3way && + test_config am.threeWay 1 && + git am lorem-move.patch && + test_path_is_missing .git/rebase-apply && + git diff --exit-code lorem +' + +test_expect_success 'am with config am.threeWay overridden by --no-3way' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout -b lorem5 base3way && + test_config am.threeWay 1 && + test_must_fail git am --no-3way lorem-move.patch && + test_path_is_dir .git/rebase-apply +' + test_expect_success 'am can rename a file' ' grep "^rename from" rename.patch && rm -fr .git/rebase-apply && -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v4 1/3] git-am.sh: fix initialization of the threeway variable
Initialization for the threeway variable was missing. This caused a behavior change for command lines like: threeway=t git am ... This commit adds initialization for this variable. Signed-off-by: Remi Lespinet --- git-am.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/git-am.sh b/git-am.sh index 761befb..c460dd0 100755 --- a/git-am.sh +++ b/git-am.sh @@ -378,6 +378,7 @@ committer_date_is_author_date= ignore_date= allow_rerere_autoupdate= gpg_sign_opt= +threeway= if test "$(git config --bool --get am.messageid)" = true then -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v4 2/3] t4150-am: refactor am -3 tests
Create a setup for git am -3 in a separate test instead of creating this setup each time. This prepares for the next commit which will use this setup as well. Signed-off-by: Remi Lespinet --- t/t4150-am.sh | 32 ++-- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 306e6f3..6ced98c 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -274,15 +274,21 @@ test_expect_success 'am --keep-non-patch really keeps the non-patch part' ' grep "^\[foo\] third" actual ' +test_expect_success 'setup am -3' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout -b base3way master2 && + sed -n -e "3,\$p" msg >file && + head -n 9 msg >>file && + git add file && + test_tick && + git commit -m "copied stuff" +' + test_expect_success 'am -3 falls back to 3-way merge' ' rm -fr .git/rebase-apply && git reset --hard && - git checkout -b lorem2 master2 && - sed -n -e "3,\$p" msg >file && - head -n 9 msg >>file && - git add file && - test_tick && - git commit -m "copied stuff" && + git checkout -b lorem2 base3way && git am -3 lorem-move.patch && test_path_is_missing .git/rebase-apply && git diff --exit-code lorem @@ -291,12 +297,7 @@ test_expect_success 'am -3 falls back to 3-way merge' ' test_expect_success 'am -3 -p0 can read --no-prefix patch' ' rm -fr .git/rebase-apply && git reset --hard && - git checkout -b lorem3 master2 && - sed -n -e "3,\$p" msg >file && - head -n 9 msg >>file && - git add file && - test_tick && - git commit -m "copied stuff" && + git checkout -b lorem3 base3way && git am -3 -p0 lorem-zero.patch && test_path_is_missing .git/rebase-apply && git diff --exit-code lorem @@ -338,12 +339,7 @@ test_expect_success 'am -3 can rename a file after falling back to 3-way merge' test_expect_success 'am -3 -q is quiet' ' rm -fr .git/rebase-apply && git checkout -f lorem2 && - git reset master2 --hard && - sed -n -e "3,\$p" msg >file && - head -n 9 msg >>file && - git add file && - test_tick && - git commit -m "copied stuff" && + git reset base3way --hard && git am -3 -q lorem-move.patch >output.out 2>&1 && ! test -s output.out ' -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC] send-email aliases when editing patches or using --xx-cmd
Hi, Working on git-send-email, I've seen that there's no aliases support when manually adding a recipient in a 'To' or 'Cc' field in a patch and for the --to-cmd and --cc-cmd. I would like to add this support, and I wonder if there are reasons not to do it. Thanks. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC] send-email aliases when editing patches or using --xx-cmd
> On Thu, Jun 4, 2015 at 5:11 PM, Stefan Beller wrote: > > On Thu, Jun 4, 2015 at 1:17 PM, Remi LESPINET > > wrote: > >> Working on git-send-email, I've seen that there's no aliases support > >> when manually adding a recipient in a 'To' or 'Cc' field in a patch > >> and for the --to-cmd and --cc-cmd. > >> > >> I would like to add this support, and I wonder if there are reasons > >> not to do it. > > > > Just recently Allen Hubbe did work on alias support, > > I did not follow that topic though. > > Allen's patch added support for another aliases format file but is > unrelated to Remi's proposal and would not conflict with it. Yes, I have read and applied the patches, this does not seems to be a problem. Thanks -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC] send-email aliases when editing patches or using --xx-cmd
On Thu, Jun 4, 2015 at 1:17 PM, Remi LESPINET wrote: > > Hi, > > Working on git-send-email, I've seen that there's no aliases support > when manually adding a recipient in a 'To' or 'Cc' field in a patch > and for the --to-cmd and --cc-cmd. > > I would like to add this support, and I wonder if there are reasons > not to do it. > > Thanks. I just realize that I totally messed up, Of course I don't want to add To or Cc fields to patches. In fact I want to add aliases support for --to-cmd and --cc-cmd options. But the modification depends on wheter we can use aliases in fields used by send-email (such as author or signoff-by..) when manually editing a patch or not. Sorry for this mistake :( -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 2/3] t4150-am: refactor am -3 tests
Create a setup for git am -3 in a separate test instead of creating this setup each time. This prepares for the next commit which will use this setup as well. Signed-off-by: Remi Lespinet --- t/t4150-am.sh | 32 ++-- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 306e6f3..6ced98c 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -274,15 +274,21 @@ test_expect_success 'am --keep-non-patch really keeps the non-patch part' ' grep "^\[foo\] third" actual ' +test_expect_success 'setup am -3' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout -b base3way master2 && + sed -n -e "3,\$p" msg >file && + head -n 9 msg >>file && + git add file && + test_tick && + git commit -m "copied stuff" +' + test_expect_success 'am -3 falls back to 3-way merge' ' rm -fr .git/rebase-apply && git reset --hard && - git checkout -b lorem2 master2 && - sed -n -e "3,\$p" msg >file && - head -n 9 msg >>file && - git add file && - test_tick && - git commit -m "copied stuff" && + git checkout -b lorem2 base3way && git am -3 lorem-move.patch && test_path_is_missing .git/rebase-apply && git diff --exit-code lorem @@ -291,12 +297,7 @@ test_expect_success 'am -3 falls back to 3-way merge' ' test_expect_success 'am -3 -p0 can read --no-prefix patch' ' rm -fr .git/rebase-apply && git reset --hard && - git checkout -b lorem3 master2 && - sed -n -e "3,\$p" msg >file && - head -n 9 msg >>file && - git add file && - test_tick && - git commit -m "copied stuff" && + git checkout -b lorem3 base3way && git am -3 -p0 lorem-zero.patch && test_path_is_missing .git/rebase-apply && git diff --exit-code lorem @@ -338,12 +339,7 @@ test_expect_success 'am -3 can rename a file after falling back to 3-way merge' test_expect_success 'am -3 -q is quiet' ' rm -fr .git/rebase-apply && git checkout -f lorem2 && - git reset master2 --hard && - sed -n -e "3,\$p" msg >file && - head -n 9 msg >>file && - git add file && - test_tick && - git commit -m "copied stuff" && + git reset base3way --hard && git am -3 -q lorem-move.patch >output.out 2>&1 && ! test -s output.out ' -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 1/3] git-am.sh: fix initialization of the threeway variable
Initialization for the threeway variable was missing. This caused a behavior change for command lines like: threeway=t git am ... This commit adds initialization for this variable. Signed-off-by: Remi Lespinet --- git-am.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/git-am.sh b/git-am.sh index 761befb..c460dd0 100755 --- a/git-am.sh +++ b/git-am.sh @@ -378,6 +378,7 @@ committer_date_is_author_date= ignore_date= allow_rerere_autoupdate= gpg_sign_opt= +threeway= if test "$(git config --bool --get am.messageid)" = true then -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 3/3] git-am: add am.threeWay config variable
Add the am.threeWay configuration variable to use the -3 or --3way option of git am by default. When am.threeway is set and not desired for a specific git am command, the --no-3way option can be used to override it. Signed-off-by: Remi Lespinet --- Only one change compared to previous version: "git-config(1)" replaced by "linkgit:git-config[1]" Documentation/config.txt | 8 Documentation/git-am.txt | 7 +-- git-am.sh| 9 + t/t4150-am.sh| 19 +++ 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index d44bc85..36b75d9 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -769,6 +769,14 @@ am.keepcr:: by giving '--no-keep-cr' from the command line. See linkgit:git-am[1], linkgit:git-mailsplit[1]. +am.threeWay:: + By default, `git am` will fail if the patch does not apply cleanly. When + set to true, this setting tells `git am` to fall back on 3-way merge if + the patch records the identity of blobs it is supposed to apply to and + we have those blobs available locally (equivalent to giving the `--3way` + option from the command line). Defaults to `false`. + See linkgit:git-am[1]. + apply.ignoreWhitespace:: When set to 'change', tells 'git apply' to ignore changes in whitespace, in the same way as the '--ignore-space-change' diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt index 0d8ba48..dbea6e7 100644 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@ -10,7 +10,7 @@ SYNOPSIS [verse] 'git am' [--signoff] [--keep] [--[no-]keep-cr] [--[no-]utf8] -[--3way] [--interactive] [--committer-date-is-author-date] +[--[no-]3way] [--interactive] [--committer-date-is-author-date] [--ignore-date] [--ignore-space-change | --ignore-whitespace] [--whitespace=] [-C] [-p] [--directory=] [--exclude=] [--include=] [--reject] [-q | --quiet] @@ -90,10 +90,13 @@ default. You can use `--no-utf8` to override this. -3:: --3way:: +--no-3way:: When the patch does not apply cleanly, fall back on 3-way merge if the patch records the identity of blobs it is supposed to apply to and we have those blobs - available locally. + available locally. `--no-3way` can be used to override + am.threeWay configuration variable. For more information, + see am.threeWay in linkgit:git-config[1]. --ignore-space-change:: --ignore-whitespace:: diff --git a/git-am.sh b/git-am.sh index c460dd0..75e701a 100755 --- a/git-am.sh +++ b/git-am.sh @@ -390,6 +390,11 @@ then keepcr=t fi +if test "$(git config --bool --get am.threeWay)" = true +then +threeway=t +fi + while test $# != 0 do case "$1" in @@ -401,6 +406,8 @@ it will be removed. Please do not use it anymore." ;; -3|--3way) threeway=t ;; + --no-3way) + threeway=f ;; -s|--signoff) sign=t ;; -u|--utf8) @@ -658,6 +665,8 @@ fi if test "$(cat "$dotest/threeway")" = t then threeway=t +else + threeway=f fi git_apply_opt=$(cat "$dotest/apply-opt") if test "$(cat "$dotest/sign")" = t diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 6ced98c..b822a39 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -303,6 +303,25 @@ test_expect_success 'am -3 -p0 can read --no-prefix patch' ' git diff --exit-code lorem ' +test_expect_success 'am with config am.threeWay falls back to 3-way merge' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout -b lorem4 base3way && + test_config am.threeWay 1 && + git am lorem-move.patch && + test_path_is_missing .git/rebase-apply && + git diff --exit-code lorem +' + +test_expect_success 'am with config am.threeWay overridden by --no-3way' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout -b lorem5 base3way && + test_config am.threeWay 1 && + test_must_fail git am --no-3way lorem-move.patch && + test_path_is_dir .git/rebase-apply +' + test_expect_success 'am can rename a file' ' grep "^rename from" rename.patch && rm -fr .git/rebase-apply && -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v2 1/5] t9001-send-email: move script creation in a setup test
Move the creation of the scripts used in to-cmd and cc-cmd tests in a setup test to make them available for later tests. This will be used in the next commit. Signed-off-by: Remi Lespinet --- t/t9001-send-email.sh | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 7be14a4..e63fc83 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -312,13 +312,19 @@ test_expect_success $PREREQ,!AUTOIDENT 'broken implicit ident aborts send-email' ) ' +test_expect_success $PREREQ 'setup tocmd and cccmd scripts' ' + write_script tocmd-sed <<-\EOF && + sed -n -e "s/^tocmd--//p" "$1" + EOF + write_script cccmd-sed <<-\EOF + sed -n -e "s/^cccmd--//p" "$1" + EOF +' + test_expect_success $PREREQ 'tocmd works' ' clean_fake_sendmail && cp $patches tocmd.patch && echo tocmd--to...@example.com >>tocmd.patch && - write_script tocmd-sed <<-\EOF && - sed -n -e "s/^tocmd--//p" "$1" - EOF git send-email \ --from="Example " \ --to-cmd=./tocmd-sed \ @@ -332,9 +338,6 @@ test_expect_success $PREREQ 'cccmd works' ' clean_fake_sendmail && cp $patches cccmd.patch && echo "cccmd-- cc...@example.com" >>cccmd.patch && - write_script cccmd-sed <<-\EOF && - sed -n -e "s/^cccmd--//p" "$1" - EOF git send-email \ --from="Example " \ --to=nob...@example.com \ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v2 4/5] send-email: allow multiple emails using --cc, --to and --bcc
From: Jorge Juan Garcia Garcia Accept a list of emails separated by commas in flags --cc, --to and --bcc. Multiple addresses can already be given by using these options multiple times, but it is more convenient to allow cutting-and-pasting a list of addresses from the header of an existing e-mail message, which already lists them as comma-separated list, as a value to a single parameter. The following format can now be used: $ git send-email --to='Jane , m...@example.com' However format using commas in names doesn't work: $ git send-email --to='"Jane, Doe" ' Remove the limitation imposed by 79ee555b (Check and document the options to prevent mistakes, 2006-06-21) which rejected every argument with comma in --cc, --to and --bcc. Helped-by: Remi Lespinet Signed-off-by: Mathieu Lienard--Mayor Signed-off-by: Jorge Juan Garcia Garcia Signed-off-by: Matthieu Moy Signed-off-by: Remi Lespinet --- I've added a test using aliases in an email-list, that's why I kept the expected test (instead of grouping it with the test "use email list in --cc --to and --bcc" as suggested in the previous RFC). Maybe it is better to delete the "use email list in --cc --to and --bcc" and group the two other in a single test ? Documentation/git-send-email.txt | 21 +-- git-send-email.perl | 23 - t/t9001-send-email.sh| 44 3 files changed, 68 insertions(+), 20 deletions(-) diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index 8045546..0146164 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -49,17 +49,23 @@ Composing of 'sendemail.annotate'. See the CONFIGURATION section for 'sendemail.multiEdit'. ---bcc=:: +--bcc=,...:: Specify a "Bcc:" value for each email. Default is the value of 'sendemail.bcc'. + -The --bcc option must be repeated for each user you want on the bcc list. +Addresses containing commas ("Doe, Jane" ) are not +currently supported. ++ +This option may be specified multiple times. ---cc=:: +--cc=,...:: Specify a starting "Cc:" value for each email. Default is the value of 'sendemail.cc'. + -The --cc option must be repeated for each user you want on the cc list. +Addresses containing commas ("Doe, Jane" ) are not +currently supported. ++ +This option may be specified multiple times. --compose:: Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1]) @@ -110,13 +116,16 @@ is not set, this will be prompted for. Only necessary if --compose is also set. If --compose is not set, this will be prompted for. ---to=:: +--to=,...:: Specify the primary recipient of the emails generated. Generally, this will be the upstream maintainer of the project involved. Default is the value of the 'sendemail.to' configuration value; if that is unspecified, and --to-cmd is not specified, this will be prompted for. + -The --to option must be repeated for each user you want on the to list. +Addresses containing commas ("Doe, Jane" ) are not +currently supported. ++ +This option may be specified multiple times. --8bit-encoding=:: When encountering a non-ASCII message or subject that does not diff --git a/git-send-email.perl b/git-send-email.perl index 0cac4b0..4bc489d 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -460,20 +460,6 @@ my ($repoauthor, $repocommitter); ($repoauthor) = Git::ident_person(@repo, 'author'); ($repocommitter) = Git::ident_person(@repo, 'committer'); -# Verify the user input - -foreach my $entry (@initial_to) { - die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/; -} - -foreach my $entry (@initial_cc) { - die "Comma in --cc entry: $entry'\n" unless $entry !~ m/,/; -} - -foreach my $entry (@bcclist) { - die "Comma in --bcclist entry: $entry'\n" unless $entry !~ m/,/; -} - sub parse_address_line { if ($have_mail_address) { return map { $_->format } Mail::Address->parse($_[0]); @@ -808,10 +794,13 @@ sub expand_one_alias { return $aliases{$alias} ? expand_aliases(@{$aliases{$alias}}) : $alias; } +@initial_to = split_at_commas(@initial_to); @initial_to = expand_aliases(@initial_to); @initial_to = validate_address_list(sanitize_address_list(@initial_to)); +@initial_cc = split_at_commas(@initial_cc); @initial_cc = expand_aliases(@initial_cc); @initial_cc = validate_address_list(sanitize_address_list(@initial_cc)); +@bcclist = split_at_commas(@bcclist); @bcclist = expand_aliases(@bcclist); @bcclist = validate_address_list(sanitize_address_list(@bcclist)); @@ -1026,6 +101
[PATCH/RFC v2 3/5] t9001-send-email: refactor header variable fields replacement
Create a function which replaces Date, Message-Id and X-Mailer lines generated by git-send-email by a specific string Date:.*$ -> Date: DATE-STRING Message-Id:.*$ -> Message-Id: MESSAGE-ID-STRING X-Mailer:.*$ -> X-Mailer: X-MAILER-STRING This is a preparatory for the next commit. Signed-off-by: Remi Lespinet --- t/t9001-send-email.sh | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 062c703..806f066 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -522,6 +522,12 @@ Result: OK EOF " +replace_variable_fields () { + sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \ + -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ + -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" +} + test_suppression () { git send-email \ --dry-run \ @@ -529,10 +535,7 @@ test_suppression () { --from="Example " \ --to=t...@example.com \ --smtp-server relay.example.com \ - $patches | - sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \ - -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ - -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \ + $patches | replace_variable_fields \ >actual-suppress-$1${2+"-$2"} && test_cmp expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"} } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v2 2/5] send-email: allow aliases in patch header and command script outputs
Interpret aliases in: - Header fields of patches generated by git format-patch (using --to, --cc, --add-header for example) or manually modified. Example of fields in header: To: alias1 Cc: alias2 Cc: alias3 - Outputs of command scripts specified by --cc-cmd and --to-cmd. Example of script: #!/bin/sh echo alias1 echo alias2 Signed-off-by: Remi Lespinet --- Note that the --from option of git format-patch takes an argument which must be formated as .*<.*> (if not, git format-patch will be aborted with fatal: invalid ident line). For this reason, passing an alias as an argument of --from is not possible, but modifying the from field in the patch manually is. git-send-email.perl | 2 ++ t/t9001-send-email.sh | 60 +++ 2 files changed, 62 insertions(+) diff --git a/git-send-email.perl b/git-send-email.perl index e1e9b14..0cac4b0 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1535,7 +1535,9 @@ foreach my $t (@files) { ($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1)); $needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc); + @to = expand_aliases(@to); @to = validate_address_list(sanitize_address_list(@to)); + @cc = expand_aliases(@cc); @cc = validate_address_list(sanitize_address_list(@cc)); @to = (@initial_to, @to); diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index e63fc83..062c703 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -1552,6 +1552,66 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' ' grep "^!someone@example\.org!$" commandline1 ' +test_expect_success $PREREQ 'alias support in To header' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 --to=sbd >aliased.patch && + git send-email \ + --from="Example " \ + --smtp-server="$(pwd)/fake.sendmail" \ + aliased.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + +test_expect_success $PREREQ 'alias support in Cc header' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 --cc=sbd >aliased.patch && + git send-email \ + --from="Example " \ + --smtp-server="$(pwd)/fake.sendmail" \ + aliased.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + +test_expect_success $PREREQ 'tocmd works with aliases' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 >tocmd.patch && + echo tocmd--sbd >>tocmd.patch && + git send-email \ + --from="Example " \ + --to-cmd=./tocmd-sed \ + --smtp-server="$(pwd)/fake.sendmail" \ + tocmd.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + +test_expect_success $PREREQ 'cccmd works with aliases' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 >cccmd.patch && + echo cccmd--sbd >>cccmd.patch && + git send-email \ + --from="Example " \ + --cc-cmd=./cccmd-sed \ + --smtp-server="$(pwd)/fake.sendmail" \ + cccmd.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + do_xmailer_test () { expected=$1 params=$2 && git format-patch -1 && -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v2 5/5] send-email: refactor address list process
Simplify code by creating a function to transform list of email lists (comma separated, with aliases ...) into a simple list of valid email addresses. Signed-off-by: Remi Lespinet --- I'm not sure about the name of the function... git-send-email.perl | 28 +--- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index 4bc489d..ea03308 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -794,15 +794,9 @@ sub expand_one_alias { return $aliases{$alias} ? expand_aliases(@{$aliases{$alias}}) : $alias; } -@initial_to = split_at_commas(@initial_to); -@initial_to = expand_aliases(@initial_to); -@initial_to = validate_address_list(sanitize_address_list(@initial_to)); +@initial_to = process_address_list(@initial_to); -@initial_cc = split_at_commas(@initial_cc); -@initial_cc = expand_aliases(@initial_cc); -@initial_cc = validate_address_list(sanitize_address_list(@initial_cc)); +@initial_cc = process_address_list(@initial_cc); -@bcclist = split_at_commas(@bcclist); -@bcclist = expand_aliases(@bcclist); -@bcclist = validate_address_list(sanitize_address_list(@bcclist)); +@bcclist = process_address_list(@bcclist); if ($thread && !defined $initial_reply_to && $prompting) { $initial_reply_to = ask( @@ -1019,6 +1013,14 @@ sub split_at_commas { return (map { split /\s*,\s*/, $_ } @_); } +sub process_address_list { +my @addr_list = split_at_commas(@_); +@addr_list = expand_aliases(@addr_list); +@addr_list = sanitize_address_list(@addr_list); +@addr_list = validate_address_list(@addr_list); +return @addr_list; +} + # Returns the local Fully Qualified Domain Name (FQDN) if available. # # Tightly configured MTAa require that a caller sends a real DNS @@ -1528,12 +1530,8 @@ foreach my $t (@files) { ($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1)); $needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc); - @to = split_at_commas(@to); - @to = expand_aliases(@to); - @to = validate_address_list(sanitize_address_list(@to)); + @to = process_address_list(@to); - @cc = split_at_commas(@cc); - @cc = expand_aliases(@cc); - @cc = validate_address_list(sanitize_address_list(@cc)); + @cc = process_address_list(@cc); @to = (@initial_to, @to); @cc = (@initial_cc, @cc); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v2 5/5] send-email: refactor address list process
Matthieu Moy writes: > Remi Lespinet writes: > > > Simplify code by creating a function to transform list of email lists > > (comma separated, with aliases ...) into a simple list of valid email > > addresses. > > I would have found the series easier to read if this refactoring came > earlier (and then PATCH 2/5 would fix the bug as a positive side effect > of the refactoring). I think it's too late to change this, though. Why is it to late? I can still change it if necessary. > > I'm not sure about the name of the function... > > process_address_list() sounds good to me. Ok nice. :) Thanks -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v2 5/5] send-email: refactor address list process
Matthieu Moy writes: > To me, the series is ready now, and I don't think re-rolling it would be > a good time investment. Plus, I spent time reviewing this series and > with my proposal I'd need to review a relatively different one. Ok, thanks. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v2 5/5] send-email: refactor address list process
Junio C Hamano writes > Matthieu Moy writes: > > > Remi Lespinet writes: > > > >> Simplify code by creating a function to transform list of email lists > >> (comma separated, with aliases ...) into a simple list of valid email > >> addresses. > > > > I would have found the series easier to read if this refactoring came > > earlier (and then PATCH 2/5 would fix the bug as a positive side effect > > of the refactoring). > > I agree that doing 5/5 sooner would make 4/5 a lot clearer. > > Introducing the helper of 5/5 before 2/5 happens, and then replacing > two calls to validate-address-list with process-address-list would > hide the nature of the change, i.e. fixing a bug, so it is better to > see it done before the refactoring of 5/5, provided if it is indeed > a bug that these were not expanded. Ok thanks, I submit it again soon. Also I think we should swap the lines 'sanitize_address_list(...)' and 'expand_aliases(...)', i.e. first sanitize addresses and then expand aliases. We could then remove leading and trailing whitespaces in the sanitize_address_list function as aliases file formats supported by git send-email doesn't take these whitespace into account anyway: Example which currently can't work: git send-email --to=" alias" ... Moreover I think it's more natural to do that so. I'll do it right after the refactoring patch introducing process_address_list or maybe I should avoid changing this patch now ? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 1/7] t9001-send-email: move script creation in a setup test
Move the creation of the scripts used in to-cmd and cc-cmd tests in a setup test to make them available for later tests. This will be used in the next commit. Signed-off-by: Remi Lespinet --- t/t9001-send-email.sh | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 7be14a4..e63fc83 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -312,13 +312,19 @@ test_expect_success $PREREQ,!AUTOIDENT 'broken implicit ident aborts send-email' ) ' +test_expect_success $PREREQ 'setup tocmd and cccmd scripts' ' + write_script tocmd-sed <<-\EOF && + sed -n -e "s/^tocmd--//p" "$1" + EOF + write_script cccmd-sed <<-\EOF + sed -n -e "s/^cccmd--//p" "$1" + EOF +' + test_expect_success $PREREQ 'tocmd works' ' clean_fake_sendmail && cp $patches tocmd.patch && echo tocmd--to...@example.com >>tocmd.patch && - write_script tocmd-sed <<-\EOF && - sed -n -e "s/^tocmd--//p" "$1" - EOF git send-email \ --from="Example " \ --to-cmd=./tocmd-sed \ @@ -332,9 +338,6 @@ test_expect_success $PREREQ 'cccmd works' ' clean_fake_sendmail && cp $patches cccmd.patch && echo "cccmd-- cc...@example.com" >>cccmd.patch && - write_script cccmd-sed <<-\EOF && - sed -n -e "s/^cccmd--//p" "$1" - EOF git send-email \ --from="Example " \ --to=nob...@example.com \ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/7] changes from last version
CHANGES (since last submitted version) 1/7 : identical to previous 1/5 2/7 : identical to previous 2/5 3/7 : identical to previous 3/5 4/7 : Modification previously done by 5/5 (refactoring address process) 5/7 : identical modulo a minor change at hunk @@ -1023,8 +1009,13 @@ in the function process_address_list due to 4/7 6/7 : new commit 7/7 : new commit CONFLICT (if merging to pu) There will be a trivial conflict if merging to pu (with 514554cf, 3169e06d and 6be02640 from Eric Sunshine and Allen Hubbe patch series). Suppressing conflict marks resolve it. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 5/7] send-email: allow multiple emails using --cc, --to and --bcc
From: Jorge Juan Garcia Garcia Accept a list of emails separated by commas in flags --cc, --to and --bcc. Multiple addresses can already be given by using these options multiple times, but it is more convenient to allow cutting-and-pasting a list of addresses from the header of an existing e-mail message, which already lists them as comma-separated list, as a value to a single parameter. The following format can now be used: $ git send-email --to='Jane , m...@example.com' However format using commas in names doesn't work: $ git send-email --to='"Jane, Doe" ' Remove the limitation imposed by 79ee555b (Check and document the options to prevent mistakes, 2006-06-21) which rejected every argument with comma in --cc, --to and --bcc. Helped-by: Remi Lespinet Signed-off-by: Mathieu Lienard--Mayor Signed-off-by: Jorge Juan Garcia Garcia Signed-off-by: Matthieu Moy Signed-off-by: Remi Lespinet --- Documentation/git-send-email.txt | 21 +-- git-send-email.perl | 21 ++- t/t9001-send-email.sh| 44 3 files changed, 65 insertions(+), 21 deletions(-) diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index 8045546..0146164 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -49,17 +49,23 @@ Composing of 'sendemail.annotate'. See the CONFIGURATION section for 'sendemail.multiEdit'. ---bcc=:: +--bcc=,...:: Specify a "Bcc:" value for each email. Default is the value of 'sendemail.bcc'. + -The --bcc option must be repeated for each user you want on the bcc list. +Addresses containing commas ("Doe, Jane" ) are not +currently supported. ++ +This option may be specified multiple times. ---cc=:: +--cc=,...:: Specify a starting "Cc:" value for each email. Default is the value of 'sendemail.cc'. + -The --cc option must be repeated for each user you want on the cc list. +Addresses containing commas ("Doe, Jane" ) are not +currently supported. ++ +This option may be specified multiple times. --compose:: Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1]) @@ -110,13 +116,16 @@ is not set, this will be prompted for. Only necessary if --compose is also set. If --compose is not set, this will be prompted for. ---to=:: +--to=,...:: Specify the primary recipient of the emails generated. Generally, this will be the upstream maintainer of the project involved. Default is the value of the 'sendemail.to' configuration value; if that is unspecified, and --to-cmd is not specified, this will be prompted for. + -The --to option must be repeated for each user you want on the to list. +Addresses containing commas ("Doe, Jane" ) are not +currently supported. ++ +This option may be specified multiple times. --8bit-encoding=:: When encountering a non-ASCII message or subject that does not diff --git a/git-send-email.perl b/git-send-email.perl index 59dcfe3..ea03308 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -460,20 +460,6 @@ my ($repoauthor, $repocommitter); ($repoauthor) = Git::ident_person(@repo, 'author'); ($repocommitter) = Git::ident_person(@repo, 'committer'); -# Verify the user input - -foreach my $entry (@initial_to) { - die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/; -} - -foreach my $entry (@initial_cc) { - die "Comma in --cc entry: $entry'\n" unless $entry !~ m/,/; -} - -foreach my $entry (@bcclist) { - die "Comma in --bcclist entry: $entry'\n" unless $entry !~ m/,/; -} - sub parse_address_line { if ($have_mail_address) { return map { $_->format } Mail::Address->parse($_[0]); @@ -1023,8 +1009,13 @@ sub sanitize_address_list { return (map { sanitize_address($_) } @_); } +sub split_at_commas { + return (map { split /\s*,\s*/, $_ } @_); +} + sub process_address_list { -my @addr_list = expand_aliases(@_); +my @addr_list = split_at_commas(@_); +@addr_list = expand_aliases(@addr_list); @addr_list = sanitize_address_list(@addr_list); @addr_list = validate_address_list(@addr_list); return @addr_list; diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 806f066..9aee474 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -1648,4 +1648,48 @@ test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=false' ' do_xmailer_test 1 "--xmailer" ' +test_expect_success $PREREQ 'setup expected-list' ' + git send-email \ + --dry-run \ + --from="Example " \ + --to="To 1 &
[PATCH v3 4/7] send-email: refactor address list process
Simplify code by creating a funct (comma separated, with aliases ...) into a simple list of valid email addresses. Signed-off-by: Remi Lespinet --- git-send-email.perl | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index 0cac4b0..59dcfe3 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -808,12 +808,9 @@ sub expand_one_alias { return $aliases{$alias} ? expand_aliases(@{$aliases{$alias}}) : $alias; } -@initial_to = expand_aliases(@initial_to); -@initial_to = validate_address_list(sanitize_address_list(@initial_to)); -@initial_cc = expand_aliases(@initial_cc); -@initial_cc = validate_address_list(sanitize_address_list(@initial_cc)); -@bcclist = expand_aliases(@bcclist); -@bcclist = validate_address_list(sanitize_address_list(@bcclist)); +@initial_to = process_address_list(@initial_to); +@initial_cc = process_address_list(@initial_cc); +@bcclist = process_address_list(@bcclist); if ($thread && !defined $initial_reply_to && $prompting) { $initial_reply_to = ask( @@ -1026,6 +1023,13 @@ sub sanitize_address_list { return (map { sanitize_address($_) } @_); } +sub process_address_list { +my @addr_list = expand_aliases(@_); +@addr_list = sanitize_address_list(@addr_list); +@addr_list = validate_address_list(@addr_list); +return @addr_list; +} + # Returns the local Fully Qualified Domain Name (FQDN) if available. # # Tightly configured MTAa require that a caller sends a real DNS @@ -1535,10 +1539,8 @@ foreach my $t (@files) { ($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1)); $needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc); - @to = expand_aliases(@to); - @to = validate_address_list(sanitize_address_list(@to)); - @cc = expand_aliases(@cc); - @cc = validate_address_list(sanitize_address_list(@cc)); + @to = process_address_list(@to); + @cc = process_address_list(@cc); @to = (@initial_to, @to); @cc = (@initial_cc, @cc); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 2/7] send-email: allow aliases in patch header and command script outputs
Interpret aliases in: - Header fields of patches generated by git format-patch (using --to, --cc, --add-header for example) or manually modified. Example of fields in header: To: alias1 Cc: alias2 Cc: alias3 - Outputs of command scripts specified by --cc-cmd and --to-cmd. Example of script: #!/bin/sh echo alias1 echo alias2 -- Note that the --from option of git format-patch takes an argument which must be formated as .*<.*> (if not, git format-patch will be aborted with fatal: invalid ident line). For this reason, passing an alias as an argument of --from is not possible, but modifying the from field in the patch manually is. Signed-off-by: Remi Lespinet --- git-send-email.perl | 2 ++ t/t9001-send-email.sh | 60 +++ 2 files changed, 62 insertions(+) diff --git a/git-send-email.perl b/git-send-email.perl index e1e9b14..0cac4b0 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1535,7 +1535,9 @@ foreach my $t (@files) { ($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1)); $needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc); + @to = expand_aliases(@to); @to = validate_address_list(sanitize_address_list(@to)); + @cc = expand_aliases(@cc); @cc = validate_address_list(sanitize_address_list(@cc)); @to = (@initial_to, @to); diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index e63fc83..062c703 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -1552,6 +1552,66 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' ' grep "^!someone@example\.org!$" commandline1 ' +test_expect_success $PREREQ 'alias support in To header' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 --to=sbd >aliased.patch && + git send-email \ + --from="Example " \ + --smtp-server="$(pwd)/fake.sendmail" \ + aliased.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + +test_expect_success $PREREQ 'alias support in Cc header' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 --cc=sbd >aliased.patch && + git send-email \ + --from="Example " \ + --smtp-server="$(pwd)/fake.sendmail" \ + aliased.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + +test_expect_success $PREREQ 'tocmd works with aliases' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 >tocmd.patch && + echo tocmd--sbd >>tocmd.patch && + git send-email \ + --from="Example " \ + --to-cmd=./tocmd-sed \ + --smtp-server="$(pwd)/fake.sendmail" \ + tocmd.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + +test_expect_success $PREREQ 'cccmd works with aliases' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 >cccmd.patch && + echo cccmd--sbd >>cccmd.patch && + git send-email \ + --from="Example " \ + --cc-cmd=./cccmd-sed \ + --smtp-server="$(pwd)/fake.sendmail" \ + cccmd.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + do_xmailer_test () { expected=$1 params=$2 && git format-patch -1 && -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 3/7] t9001-send-email: refactor header variable fields replacement
Create a function which replaces Date, Message-Id and X-Mailer lines generated by git-send-email by a specific string Date:.*$ -> Date: DATE-STRING Message-Id:.*$ -> Message-Id: MESSAGE-ID-STRING X-Mailer:.*$ -> X-Mailer: X-MAILER-STRING This is a preparatory for the next commit. Signed-off-by: Remi Lespinet --- t/t9001-send-email.sh | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 062c703..806f066 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -522,6 +522,12 @@ Result: OK EOF " +replace_variable_fields () { + sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \ + -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ + -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" +} + test_suppression () { git send-email \ --dry-run \ @@ -529,10 +535,7 @@ test_suppression () { --from="Example " \ --to=t...@example.com \ --smtp-server relay.example.com \ - $patches | - sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \ - -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ - -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \ + $patches | replace_variable_fields \ >actual-suppress-$1${2+"-$2"} && test_cmp expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"} } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 7/7] send-email: suppress leading and trailing whitespaces before alias expansion
As alias file formats supported by git send-email doesn't take whitespace into account, it is useless to consider whitespaces in alias name. remove leading and trailing whitespace before expanding allow to recognize strings like " alias" or "alias\t" passed by --to, --cc, --bcc options or by the git send-email prompt. Signed-off-by: Remi Lespinet --- git-send-email.perl | 1 + t/t9001-send-email.sh | 24 2 files changed, 25 insertions(+) diff --git a/git-send-email.perl b/git-send-email.perl index 3d144bd..34c8b8b 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -787,6 +787,7 @@ sub expand_aliases { my %EXPANDED_ALIASES; sub expand_one_alias { my $alias = shift; + $alias =~ s/^\s+|\s+$//g; if ($EXPANDED_ALIASES{$alias}) { die "fatal: alias '$alias' expands to itself\n"; } diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 9aee474..bbfed56 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -1692,4 +1692,28 @@ test_expect_success $PREREQ 'aliases work with email list' ' test_cmp expected-list actual-list ' +test_expect_success $PREREQ 'leading and trailing whitespaces are removed' ' + echo "alias to2 t...@example.com" >.mutt && + echo "alias cc1 Cc 1 " >>.mutt && + test_config sendemail.aliasesfile ".mutt" && + test_config sendemail.aliasfiletype mutt && + TO1=$(echo "QTo 1 " | q_to_tab) && + TO2=$(echo "QZto2" | qz_to_tab_space) && + CC1=$(echo "cc1" | append_cr) && + BCC1=$(echo "Q b...@example.com Q" | q_to_nul) && + git send-email \ + --dry-run \ + --from="Example " \ + --to="$TO1" \ + --to="$TO2" \ + --to=" t...@example.com " \ + --cc="$CC1" \ + --cc="Cc2 " \ + --bcc="$BCC1" \ + --bcc="b...@example.com" \ + 0001-add-master.patch | replace_variable_fields \ + >actual-list && + test_cmp expected-list actual-list +' + test_done -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 6/7] send-email: suppress leading and trailing whitespaces in addresses
Remove leading and trailing whitespaces when sanitizing addresses so that git send-email give the same output when passing arguments like " j...@example.com " or "\t j...@example.com " as with "j...@example.com". The next commit will introduce a test for this aswell. Signed-off-by: Remi Lespinet --- git-send-email.perl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/git-send-email.perl b/git-send-email.perl index ea03308..3d144bd 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -978,6 +978,9 @@ sub sanitize_address { # remove garbage after email address $recipient =~ s/(.*>).*$/$1/; + # remove leading and trailing whitespace + $recipient =~ s/^\s+|\s+$//g; + my ($recipient_name, $recipient_addr) = ($recipient =~ /^(.*?)\s*(<.*)/); if (not $recipient_name) { -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 6/7] send-email: suppress leading and trailing whitespaces in addresses
> Nothing serious, but you did something weird while sending. This message > does not have a References: or an In-reply-to: field, so it breaks > threading. See how it's displayed on > > http://thread.gmane.org/gmane.comp.version-control.git Yes, send-email was aborted after 5/7, I realized and retry sending 6/7 and 7/7 but I didn't noticed that. I'll be careful next time, thanks. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 7/7] send-email: suppress leading and trailing whitespaces before alias expansion
Matthieu Moy writes: > Actually, once you have this, PATCH 6/7 becomes useless, right? (at > least, the test passes if I revert it) > It seems to me that doing this space trimming just once, inside or right > after split_at_commas would be clearer. You're right, I put it twice because of there's occurrences of sanitize_address which are not associated with expand_aliases, but it seems that it's all taken care of separately in different regexp. So there's no point to 6/7. I agree, I'd like to put it right after split_at_commas in a separate function "trim_list". Is it a good idea even if the function is one line long ? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 7/7] send-email: suppress leading and trailing whitespaces before alias expansion
Matthieu Moy writes: > Junio C Hamano writes: > > > Remi Lespinet writes: > > > >> I agree, I'd like to put it right after split_at_commas in a separate > >> function "trim_list". Is it a good idea even if the function is one > >> line long ? > > > > Hmph, if I have "A, B, C" and call a function that gives an array of > > addresses, treating the input as comma-separated addresses, I would > > expect ("A", "B", "C") to be returned from that function, instead of > > having to later trim the whitespace around what is returned. > > It is actually doing this. But if you have " A,B,C ", then you'll get > " A", "B", "C ". But once you're trimming around commas, trimming > leading and trailing spaces fits well with split itself. Yes and if we have a single address with leading or/and trailing whitespaces, such as " A ", I think that we don't expect split_in_commas to suppress these whitespaces as there's no commas in this address. As Junio said, I think I should rename the function. Thanks! -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC] send-email quote issues
Hi, I'm currently working on git send-email to allow passing names containing commas. I would like to specify that the comma shouldn't be interpreted as a delimiter when there's quotes around: "Jane, Katarina Doe" This changes the behavior of the double quote. For example when passing: --to='"Jane" Doe ' to git send-email, the line produced was: To: "\"Jane\" Doe" With this modification, it would be: To: Jane Doe or To: "Jane Doe" And this will not be possible to use quote in a name anymore. Is this a problem ? Currently, git send-email contains a function which splits at commas with respect to quotes (parse_address_line introduced by 5012699d9840fe34fe0838ea0d529c2f32f76b82). It is used to parse user input when there's no recipient specified. I would like to use this function to parse --to, --cc and --bcc options, but the execution of this function depends on whether the user has the Perl library Mail::Address or not. This introduce a change in the behaviour: Output1 represents lines produced with the Mail::Address library Output2 represents lines produced without the Mail::Address library 1) Simple quote are not interpreted the same way: Input : 'Doe, "Jane' Output1 : 'Doe, "\" Jane'" Output2 : "'Doe, \"Jane'" Input : 'Jane 'Doe' Output1 : 'Jane 'Doe' Output2 : ERROR 2) Mail::Address adds a space when using a quote or a backslash in a name Input : "Jane Do"e Output1 : "\"Jane Do\" e" Output2 : "\"Jane Do\"e" Input : \Jane Doe Output1 : "\ Jane Doe" Output2 : "\Jane Doe" 3) Mail::Address works when quote is not closed Input : "Jane Doe Output1 : "\" Jane Doe" Output2 : ERROR 4) Mail::Address splits the string when there's no comma Input : Jane "Doe " Output1 : Jane, "\"Doe" Output2 : "Jane \"Doe" The following doesn't work for both: Input : "Jane Doe " Output1 : ERROR Output2 : ERROR -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC] send-email quote issues
Matthieu Moy writes > I would say that using parse_address_line is good for consistancy in Git > anyway. If the behavior of parse_address_line is broken on some > corner-cases, then it should be fixed anyway. Ok, but I don't know what fixed means in these particular cases. Actually the problem when we have a quote in a name is: Is this a delimiter or is this an ascii char? Currently the problem is solved by saying : it's an ascii char unless there is two quotes aroung all the name (modulo minor things). So if I write: --to='"Jane, Kararina" Doe ' they are considered characters. Which means that this is different than: --to='"Jane, Kararina Doe" ' Is this expected? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC] send-email quote issues
Matthieu Moy writes > To me, the answer should be: do whatever the RFC says in email headers. > I'd expect anything that works in the To: header to work in the --to > option of git send-email. Ok sounds good to me ! -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v4 02/10] send-email: allow aliases in patch header and command script outputs
Interpret aliases in: - Header fields of patches generated by git format-patch (using --to, --cc, --add-header for example) or manually modified. Example of fields in header: To: alias1 Cc: alias2 Cc: alias3 - Outputs of command scripts specified by --cc-cmd and --to-cmd. Example of script: #!/bin/sh echo alias1 echo alias2 Signed-off-by: Remi Lespinet --- git-send-email.perl | 2 ++ t/t9001-send-email.sh | 60 +++ 2 files changed, 62 insertions(+) diff --git a/git-send-email.perl b/git-send-email.perl index 6bedf74..8bf38ee 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1560,7 +1560,9 @@ foreach my $t (@files) { ($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1)); $needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc); + @to = expand_aliases(@to); @to = validate_address_list(sanitize_address_list(@to)); + @cc = expand_aliases(@cc); @cc = validate_address_list(sanitize_address_list(@cc)); @to = (@initial_to, @to); diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index eef12e6..f7d4132 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -1579,6 +1579,66 @@ test_expect_success $PREREQ 'sendemail.aliasfiletype=sendmail' ' grep "^!o@example\.com!$" commandline1 ' +test_expect_success $PREREQ 'alias support in To header' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 --to=sbd >aliased.patch && + git send-email \ + --from="Example " \ + --smtp-server="$(pwd)/fake.sendmail" \ + aliased.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + +test_expect_success $PREREQ 'alias support in Cc header' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 --cc=sbd >aliased.patch && + git send-email \ + --from="Example " \ + --smtp-server="$(pwd)/fake.sendmail" \ + aliased.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + +test_expect_success $PREREQ 'tocmd works with aliases' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 >tocmd.patch && + echo tocmd--sbd >>tocmd.patch && + git send-email \ + --from="Example " \ + --to-cmd=./tocmd-sed \ + --smtp-server="$(pwd)/fake.sendmail" \ + tocmd.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + +test_expect_success $PREREQ 'cccmd works with aliases' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 >cccmd.patch && + echo cccmd--sbd >>cccmd.patch && + git send-email \ + --from="Example " \ + --cc-cmd=./cccmd-sed \ + --smtp-server="$(pwd)/fake.sendmail" \ + cccmd.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + do_xmailer_test () { expected=$1 params=$2 && git format-patch -1 && -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v4 06/10] send-email: minor code refactoring
Group expressions in a single if statement. This avoid checking multiple time if the variable $sender is defined. Signed-off-by: Remi Lespinet --- git-send-email.perl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index f61449d..a0cd7ff 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -799,9 +799,9 @@ if (!$force) { } } -($sender) = expand_aliases($sender) if defined $sender; - -if (!defined $sender) { +if (defined $sender) { + ($sender) = expand_aliases($sender); +} else { $sender = $repoauthor || $repocommitter || ''; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v4 05/10] send-email: Allow use of aliases in the From field of --compose mode
Aliases were expanded before checking the From field of the --compose option. This is inconsistent with other fields (To, Cc, ...) which already support aliases. Signed-off-by: Remi Lespinet --- git-send-email.perl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index 2d5c530..f61449d 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -555,8 +555,6 @@ if (@alias_files and $aliasfiletype and defined $parse_alias{$aliasfiletype}) { } } -($sender) = expand_aliases($sender) if defined $sender; - # is_format_patch_arg($f) returns 0 if $f names a patch, or 1 if # $f is a revision list specification to be passed to format-patch. sub is_format_patch_arg { @@ -801,6 +799,8 @@ if (!$force) { } } +($sender) = expand_aliases($sender) if defined $sender; + if (!defined $sender) { $sender = $repoauthor || $repocommitter || ''; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v4 03/10] t9001-send-email: refactor header variable fields replacement
Create a function which replaces Date, Message-Id and X-Mailer lines generated by git-send-email by a specific string: Date:.*$ -> Date: DATE-STRING Message-Id:.*$ -> Message-Id: MESSAGE-ID-STRING X-Mailer:.*$ -> X-Mailer: X-MAILER-STRING Signed-off-by: Remi Lespinet --- t/t9001-send-email.sh | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index f7d4132..714fcae 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -522,6 +522,12 @@ Result: OK EOF " +replace_variable_fields () { + sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \ + -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ + -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" +} + test_suppression () { git send-email \ --dry-run \ @@ -529,10 +535,7 @@ test_suppression () { --from="Example " \ --to=t...@example.com \ --smtp-server relay.example.com \ - $patches | - sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \ - -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ - -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \ + $patches | replace_variable_fields \ >actual-suppress-$1${2+"-$2"} && test_cmp expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"} } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v4 04/10] send-email: refactor address list process
Simplify code by creating a function which transform a list of strings containing email addresses (separated by commas, comporting aliases) into a clean list of valid email addresses. Signed-off-by: Remi Lespinet --- git-send-email.perl | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index 8bf38ee..2d5c530 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -833,12 +833,9 @@ sub expand_one_alias { return $aliases{$alias} ? expand_aliases(@{$aliases{$alias}}) : $alias; } -@initial_to = expand_aliases(@initial_to); -@initial_to = validate_address_list(sanitize_address_list(@initial_to)); -@initial_cc = expand_aliases(@initial_cc); -@initial_cc = validate_address_list(sanitize_address_list(@initial_cc)); -@bcclist = expand_aliases(@bcclist); -@bcclist = validate_address_list(sanitize_address_list(@bcclist)); +@initial_to = process_address_list(@initial_to); +@initial_cc = process_address_list(@initial_cc); +@bcclist = process_address_list(@bcclist); if ($thread && !defined $initial_reply_to && $prompting) { $initial_reply_to = ask( @@ -1051,6 +1048,13 @@ sub sanitize_address_list { return (map { sanitize_address($_) } @_); } +sub process_address_list { + my @addr_list = expand_aliases(@_); + @addr_list = sanitize_address_list(@addr_list); + @addr_list = validate_address_list(@addr_list); + return @addr_list; +} + # Returns the local Fully Qualified Domain Name (FQDN) if available. # # Tightly configured MTAa require that a caller sends a real DNS @@ -1560,10 +1564,8 @@ foreach my $t (@files) { ($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1)); $needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc); - @to = expand_aliases(@to); - @to = validate_address_list(sanitize_address_list(@to)); - @cc = expand_aliases(@cc); - @cc = validate_address_list(sanitize_address_list(@cc)); + @to = process_address_list(@to); + @cc = process_address_list(@cc); @to = (@initial_to, @to); @cc = (@initial_cc, @cc); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v4 01/10] t9001-send-email: move script creation in a setup test
Move the creation of the scripts used in to-cmd and cc-cmd tests in a setup test to make them available for later tests. Signed-off-by: Remi Lespinet --- t/t9001-send-email.sh | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index a3663da..eef12e6 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -312,13 +312,19 @@ test_expect_success $PREREQ,!AUTOIDENT 'broken implicit ident aborts send-email' ) ' +test_expect_success $PREREQ 'setup tocmd and cccmd scripts' ' + write_script tocmd-sed <<-\EOF && + sed -n -e "s/^tocmd--//p" "$1" + EOF + write_script cccmd-sed <<-\EOF + sed -n -e "s/^cccmd--//p" "$1" + EOF +' + test_expect_success $PREREQ 'tocmd works' ' clean_fake_sendmail && cp $patches tocmd.patch && echo tocmd--to...@example.com >>tocmd.patch && - write_script tocmd-sed <<-\EOF && - sed -n -e "s/^tocmd--//p" "$1" - EOF git send-email \ --from="Example " \ --to-cmd=./tocmd-sed \ @@ -332,9 +338,6 @@ test_expect_success $PREREQ 'cccmd works' ' clean_fake_sendmail && cp $patches cccmd.patch && echo "cccmd-- cc...@example.com" >>cccmd.patch && - write_script cccmd-sed <<-\EOF && - sed -n -e "s/^cccmd--//p" "$1" - EOF git send-email \ --from="Example " \ --to=nob...@example.com \ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v4 07/10] send-email: reduce dependancies impact on parse_address_line
parse_address_line had not the same behavior whether the user had Mail::Address or not. Teach parse_address_line to behave like Mail::Address. When the user input is correct, this implementation behaves exactly like Mail::Address except when there are quotes inside the name: "Jane Do"e In this case the result of parse_address_line is: With M::A : "Jane Do" e Without : "Jane Do e" When the user input is not correct, the behavior is also mostly the same. Unlike Mail::Address, this doesn't parse groups and recursive commentaries. Signed-off-by: Remi Lespinet --- git-send-email.perl | 54 +++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index a0cd7ff..a1f6c18 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -477,9 +477,59 @@ foreach my $entry (@bcclist) { sub parse_address_line { if ($have_mail_address) { return map { $_->format } Mail::Address->parse($_[0]); - } else { - return split_addrs($_[0]); } + + my $commentrgx=qr/\((?:[^)]*)\)/; + my $quotergx=qr/"(?:[^\"\\]|\\.)*"/; + my $wordrgx=qr/(?:[^]["\s()<>:;@\\,.]|\\.)+/; + my $tokenrgx = qr/(?:$quotergx|$wordrgx|$commentrgx|\S)/; + + my @tokens = map { $_ =~ /\s*($tokenrgx)\s*/g } @_; + push @tokens, ","; + + my (@addr_list, @phrase, @address, @comment, @buffer) = (); + foreach my $token (@tokens) { + if ($token =~ /^[,;]$/) { + if (@address) { + push @address, @buffer; + } else { + push @phrase, @buffer; + } + + my $str_phrase = join ' ', @phrase; + my $str_address = join '', @address; + my $str_comment = join ' ', @comment; + + if ($str_phrase =~ /[][()<>:;@\\,.\000-\037\177]/) { + $str_phrase =~ s/(^|[^\\])"/$1/g; + $str_phrase = qq["$str_phrase"]; + } + + if ($str_address ne "" && $str_phrase ne "") { + $str_address = qq[<$str_address>]; + } + + my $str_mailbox = "$str_phrase $str_address $str_comment"; + $str_mailbox =~ s/^\s*|\s*$//g; + push @addr_list, $str_mailbox if ($str_mailbox); + + @phrase = @address = @comment = @buffer = (); + } elsif ($token =~ /^\(/) { + push @comment, $token; + } elsif ($token eq "<") { + push @phrase, (splice @address), (splice @buffer); + } elsif ($token eq ">") { + push @address, (splice @buffer); + } elsif ($token eq "@") { + push @address, (splice @buffer), "@"; + } elsif ($token eq ".") { + push @address, (splice @buffer), "."; + } else { + push @buffer, $token; + } + } + + return @addr_list; } sub split_addrs { -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v4 10/10] send-email: suppress meaningless whitespaces in from field
Remove leading and trailing whitespaces in from field before interepreting it to improve consistency with other options. The split_addrs function already take care of trailing and leading whitespaces for to, cc and bcc fields. The from option now: - has the same behavior when passing arguments like " j...@example.com ", "\t j...@example.com " or "j...@example.com". - interprets aliases in string containing leading and trailing whitespaces such as " alias" or "alias\t" like other options. Signed-off-by: Remi Lespinet --- git-send-email.perl | 1 + t/t9001-send-email.sh | 24 2 files changed, 25 insertions(+) diff --git a/git-send-email.perl b/git-send-email.perl index 265299e..9b28dfa 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -836,6 +836,7 @@ if (!$force) { } if (defined $sender) { + $sender =~ s/^\s+|\s$//g; ($sender) = expand_aliases($sender); } else { $sender = $repoauthor || $repocommitter || ''; diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 3c5b853..8e21fb0 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -1719,4 +1719,28 @@ test_expect_success $PREREQ 'aliases work with email list' ' test_cmp expected-list actual-list ' +test_expect_success $PREREQ 'leading and trailing whitespaces are removed' ' + echo "alias to2 t...@example.com" >.mutt && + echo "alias cc1 Cc 1 " >>.mutt && + test_config sendemail.aliasesfile ".mutt" && + test_config sendemail.aliasfiletype mutt && + TO1=$(echo "QTo 1 " | q_to_tab) && + TO2=$(echo "QZto2" | qz_to_tab_space) && + CC1=$(echo "cc1" | append_cr) && + BCC1=$(echo "Q b...@example.com Q" | q_to_nul) && + git send-email \ + --dry-run \ + --from="Example " \ + --to="$TO1" \ + --to="$TO2" \ + --to=" t...@example.com " \ + --cc="$CC1" \ + --cc="Cc2 " \ + --bcc="$BCC1" \ + --bcc="b...@example.com" \ + 0001-add-master.patch | replace_variable_fields \ + >actual-list && + test_cmp expected-list actual-list +' + test_done -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v4 09/10] send-email: allow multiple emails using --cc, --to and --bcc
Accept a list of emails separated by commas in flags --cc, --to and --bcc. Multiple addresses can already be given by using these options multiple times, but it is more convenient to allow cutting-and-pasting a list of addresses from the header of an existing e-mail message, which already lists them as comma-separated list, as a value to a single parameter. The following format can now be used: $ git send-email --to='Jane , m...@example.com' Remove the limitation imposed by 79ee555b (Check and document the options to prevent mistakes, 2006-06-21) which rejected every argument with comma in --cc, --to and --bcc. Helped-by: Remi Lespinet Signed-off-by: Mathieu Lienard--Mayor Signed-off-by: Jorge Juan Garcia Garcia Signed-off-by: Matthieu Moy Signed-off-by: Remi Lespinet --- Documentation/git-send-email.txt | 12 +-- git-send-email.perl | 17 ++-- t/t9001-send-email.sh| 44 3 files changed, 52 insertions(+), 21 deletions(-) diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index b48a764..afd9569 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -49,17 +49,17 @@ Composing of 'sendemail.annotate'. See the CONFIGURATION section for 'sendemail.multiEdit'. ---bcc=:: +--bcc=,...:: Specify a "Bcc:" value for each email. Default is the value of 'sendemail.bcc'. + -The --bcc option must be repeated for each user you want on the bcc list. +This option may be specified multiple times. ---cc=:: +--cc=,...:: Specify a starting "Cc:" value for each email. Default is the value of 'sendemail.cc'. + -The --cc option must be repeated for each user you want on the cc list. +This option may be specified multiple times. --compose:: Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1]) @@ -110,13 +110,13 @@ is not set, this will be prompted for. Only necessary if --compose is also set. If --compose is not set, this will be prompted for. ---to=:: +--to=,...:: Specify the primary recipient of the emails generated. Generally, this will be the upstream maintainer of the project involved. Default is the value of the 'sendemail.to' configuration value; if that is unspecified, and --to-cmd is not specified, this will be prompted for. + -The --to option must be repeated for each user you want on the to list. +This option may be specified multiple times. --8bit-encoding=:: When encountering a non-ASCII message or subject that does not diff --git a/git-send-email.perl b/git-send-email.perl index 8594ab9..265299e 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -460,20 +460,6 @@ my ($repoauthor, $repocommitter); ($repoauthor) = Git::ident_person(@repo, 'author'); ($repocommitter) = Git::ident_person(@repo, 'committer'); -# Verify the user input - -foreach my $entry (@initial_to) { - die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/; -} - -foreach my $entry (@initial_cc) { - die "Comma in --cc entry: $entry'\n" unless $entry !~ m/,/; -} - -foreach my $entry (@bcclist) { - die "Comma in --bcclist entry: $entry'\n" unless $entry !~ m/,/; -} - sub parse_address_line { if ($have_mail_address) { return map { $_->format } Mail::Address->parse($_[0]); @@ -1101,7 +1087,8 @@ sub sanitize_address_list { } sub process_address_list { - my @addr_list = expand_aliases(@_); + my @addr_list = map { parse_address_line($_) } @_; + @addr_list = expand_aliases(@addr_list); @addr_list = sanitize_address_list(@addr_list); @addr_list = validate_address_list(@addr_list); return @addr_list; diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 714fcae..3c5b853 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -1675,4 +1675,48 @@ test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=false' ' do_xmailer_test 1 "--xmailer" ' +test_expect_success $PREREQ 'setup expected-list' ' + git send-email \ + --dry-run \ + --from="Example " \ + --to="To 1 " \ + --to="t...@example.com" \ + --to="t...@example.com" \ + --cc="Cc 1 " \ + --cc="Cc2 " \ + --bcc="b...@example.com" \ + --bcc="b...@example.com" \ + 0001-add-master.patch | replace_variable_fields \ + >expected-list +' + +test_expect_success $PREREQ 'use email list in --cc --to and --bcc' ' + git send-email \ + --dry-run \ + --from="Example " \ + --to="To 1 ,
[PATCH/RFC v4 08/10] send-email: consider quote as delimiter instead of character
Do not consider quote inside a recipient name as character when they are not escaped. This interprets: "Jane" "Doe" as: "Jane Doe" instead of: "Jane\" \"Doe" Signed-off-by: Remi Lespinet --- I don't know if it's an argument for this change, but rfc2822 says: Semantically, neither the optional CFWS outside of the quote characters nor the quote characters themselves are part of the quoted-string... git-send-email.perl | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index a1f6c18..8594ab9 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1078,15 +1078,17 @@ sub sanitize_address { return $recipient; } + # remove non-escaped quotes + $recipient_name =~ s/(^|[^\\])"/$1/g; + # rfc2047 is needed if a non-ascii char is included if ($recipient_name =~ /[^[:ascii:]]/) { - $recipient_name =~ s/^"(.*)"$/$1/; $recipient_name = quote_rfc2047($recipient_name); } # double quotes are needed if specials or CTLs are included elsif ($recipient_name =~ /[][()<>@,;:\\".\000-\037\177]/) { - $recipient_name =~ s/(["\\\r])/\\$1/g; + $recipient_name =~ s/([\\\r])/\\$1/g; $recipient_name = qq["$recipient_name"]; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v4 10/10] send-email: suppress meaningless whitespaces in from field
Matthieu Moy writes > Remi Lespinet writes: > > if (defined $sender) { > > + $sender =~ s/^\s+|\s$//g; > I would say \s+ also for the second \s. Not really different, but it > feels wrong to iterate the substitution as many times as there are > trailing spaces to remove. Oops should have read it one more time... Thanks. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v4 07/10] send-email: reduce dependancies impact on parse_address_line
Matthieu Moy writes > > + my $commentrgx=qr/\((?:[^)]*)\)/; > > + my $quotergx=qr/"(?:[^\"\\]|\\.)*"/; > > + my $wordrgx=qr/(?:[^]["\s()<>:;@\\,.]|\\.)+/; > > Spaces around = please. > ... > > + foreach my $token (@tokens) { > > + if ($token =~ /^[,;]$/) { > > Here and below: you're indenting with a 4-column offset, it should be 8. Should have spent more time on the form... Thanks > The code below is a bit hard to read (I'm neither fluent in Perl nor in > the RFC ...). A few more comments would help. A few examples below (it's > up to you to integrate them or not). Ok, I'll add comments for the hardest parts. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v4 07/10] send-email: reduce dependancies impact on parse_address_line
> Junio C Hamano writes > Suffix "rgx" that means "regular expression" is a bit unusual, and > also hard to read when squashed to another word. Elsewhere in the > same script, we seem to use $re_whatever to store precompiled > regular expressions, so perhaps $re_comment, $re_quote, etc.? Yes it's indeed a better name. I had not seen it, thanks! > > +if ($str_address ne "" && $str_phrase ne "") { > > +$str_address = qq[<$str_address>]; > > +} > > We see both "git@vger.kernel.org" and "" around > here for an address without comment or phrase; this chooses to turn > them both into "" form? Not a complaint but am > thinking aloud to see if I am reading it correctly. If there's no phrase, this will choose the "git@vger.kernel.org" form, in both cases, because it'll be recognize as an address, $str_address will be "git@vger.kernel.org" and $str_phrase will be empty before the if ($str_address ne "" ...) Here are some tests: Input: Split: j...@example.com M::A : j...@example.com -- Input: j...@example.com Split: j...@example.com M::A : j...@example.com -- Input: Jane Split: Jane M::A : Jane -- Input: Jane Doe Split: Jane Doe M::A : Jane Doe -- Input: "Jane" Split: "Jane" M::A : "Jane" -- Input: "Doe, Jane" Split: "Doe, Jane" M::A : "Doe, Jane" I've some more tests, maybe I should put them all in this post ? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v4 07/10] send-email: reduce dependancies impact on parse_address_line
> Remi Lespinet writes: > > > I've some more tests, maybe I should put them all in this post ? > > Yes, please post as much as you have. Ideally, this should be > automatically tested, but if you don't have time to write the automated > tests, at least having a track of what you did on the list archives can > help someone else to do it. It may not be easily readable without colors, so there are the scripts at the end. You can change the tested input by changing lines after the "cat >.tmplist" line in testall.sh. (There are two scripts testall.sh and testone.perl). Here are the tests results: Input: Split: M::A : Same : Yes -- Input: Jane Split: Jane M::A : Jane Same : Yes -- Input: j...@example.com Split: j...@example.com M::A : j...@example.com Same : Yes -- Input: Split: j...@example.com M::A : j...@example.com Same : Yes -- Input: Jane Split: Jane M::A : Jane Same : Yes -- Input: Jane Doe Split: Jane Doe M::A : Jane Doe Same : Yes -- Input: Jane\ Doe Split: "Jane\ Doe" M::A : "Jane \ Doe" Same : No -- Input: "Jane" Split: "Jane" M::A : "Jane" Same : Yes -- Input: "Doe, Jane" Split: "Doe, Jane" M::A : "Doe, Jane" Same : Yes -- Input: "Doe, Ja"ne Split: "Doe, Ja ne" M::A : "Doe, Ja" ne Same : No -- Input: "Doe, Katarina" Jane Split: "Doe, Katarina Jane" M::A : "Doe, Katarina" Jane Same : No -- Input: "Jane@:;\>.,() Split: "Jane@:;\>.,() M::A : "Jane@:;\>.,() Same : Yes -- Input: Jane@:;\.,()<>Doe Split: Jane@: : "\." : Doe () M::A : Jane@: : \. : Doe () Same : No -- Input: Jane!#$%&'*+-/=?^_{|}~Doe' Split: Jane!#$%&'*+-/=?^_{|}~Doe' M::A : Jane!#$%&'*+-/=?^_{|}~Doe' Same : Yes -- Input: "" Split: "" M::A : "" Same : Yes -- Input: "Jane j...@example.com" Split: "Jane j...@example.com" M::A : "Jane j...@example.com" Same : Yes -- Input: Jane Doe Split: Jane Doe M::A : Jane Doe Same : Yes -- Input: Jane Doe < j...@example.com > Split: Jane Doe M::A : Jane Doe Same : Yes -- Input: Jane @ Doe @ Jane @ Doe Split: Jane@Doe@Jane@Doe M::A : Jane@Doe@Jane@Doe Same : Yes -- Input: Jane j...@example.com Split: janej...@example.com M::A : Jane : j...@example.com Same : No -- Input: Jane Doe Split: jdoe@example.comJaneDoe M::A : Jane Doe Same : No -- Input: Jane Doe Split: Jane M::A : Jane Doe Same : No -- Input: "Jane, 'Doe'" Split: "Jane, 'Doe'" M::A : "Jane, 'Doe'" Same : Yes -- Input: 'Doe, "Jane' Split: 'Doe : " Jane' M::A : 'Doe : " Jane' Same : Yes -- Input: "Jane" "Do"e Split: "Jane" "Do" e M::A : "Jane" "Do" e Same : Yes -- Input: "Jane' Doe" Split: "Jane' Doe" M::A : "Jane' Doe" Same : Yes -- Input: "Jane Doe " Split: "Jane Doe " M::A : "Jane Doe " Same : Yes -- Input: "Jane\" Doe" Split: "Jane\" Doe" M::A : "Jane\" Doe" Same : Yes -- Input: Doe, jane Split: Doe : jane M::A : Doe : jane Same : Yes -- Input: "Jane Doe Split: " Jane Doe M::A : " Jane Doe Same : Yes -- Input: "Jane "Kat"a" ri"na" ",Doe" Split: "Jane Kat a ri na ,Doe" M::A : "Jane " Kat "a" ri "na" ",Doe" Same : No -- Input: Jane Doe Split: Jane Doe M::A : Jane : Doe Same : No -- Input: Jane "Doe " Split: "Jane Doe " M::A : Jane : "Doe " Same : No -- Input: \"Jane Doe Split: "\"Jane Doe" M::A : \ " Jane Doe Same : No -- Input: Jane\"\" Doe Split: "Jane\"\" Doe" M::A : Jane \ " \ " Doe Same : No -- Input: 'Jane 'Doe' Split: 'Jane 'Doe' M::A : 'Jane 'Doe' Same : Yes -- Input: 'Jane "Katarina\" \' Doe' Split: "'Jane Katarina\" \' Doe'" M::A : 'Jane " Katarina \ " \ ' Doe' Same : No ** * SCRIPTS PART * ***
[PATCH/RFC v4 07/10] send-email: reduce dependancies impact on parse_address_line
Matthieu Moy writes: > Cool. Then almost all the work is done to get an automated test. Next > step would be to add the tests itself in the code. I would do that by > adding a hidden --selfcheck option to git send-email that would compare > Mail::Address->parse($string); and split_addrs($string); for all your > testcases, and die if they do not match. Then calling it from the > testsuite would be trivial. Ok, are there such "--selfcheck" options elsewhere? If I understand it right, you want to put the tests inside the git-send-email script. I don't feel really good about that but I guess it's hard to test it otherwise... Also what will we do with the failing tests? Just discard them? I think there's two sort of failing test: - When output provided by parse_address_ without Mail::Address is better or has no impact at all on the code. Such as: Input: "Doe, Ja"ne Split: "Doe, Ja ne" M::A : "Doe, Ja" ne This output is done on purpose. If it was the same output with Mail::Address, we could have avoided commit 8/9 of this serie btw. I think we should also test these cases. - When we don't really care about the output, because the user entry is wrong, and we just expect the script to be aborted somehow... We don't need to test that. We could also add an option to specify whether we want to use Mail::Address or not and do the tests in t9001* (but this would take much more time). > I can do that on top of your series if you don't have time. Time will become a problem soon, but I think I can handle it unless you really want to do it ! -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 06/10] send-email: minor code refactoring
Group expressions in a single if statement. This avoid checking multiple time if the variable $sender is defined. Signed-off-by: Remi Lespinet --- git-send-email.perl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index f61449d..a0cd7ff 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -799,9 +799,9 @@ if (!$force) { } } -($sender) = expand_aliases($sender) if defined $sender; - -if (!defined $sender) { +if (defined $sender) { + ($sender) = expand_aliases($sender); +} else { $sender = $repoauthor || $repocommitter || ''; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in
[PATCH v5 02/10] send-email: allow aliases in patch header and command script outputs
Interpret aliases in: - Header fields of patches generated by git format-patch (using --to, --cc, --add-header for example) or manually modified. Example of fields in header: To: alias1 Cc: alias2 Cc: alias3 - Outputs of command scripts specified by --cc-cmd and --to-cmd. Example of script: #!/bin/sh echo alias1 echo alias2 Signed-off-by: Remi Lespinet --- git-send-email.perl | 2 ++ t/t9001-send-email.sh | 60 +++ 2 files changed, 62 insertions(+) diff --git a/git-send-email.perl b/git-send-email.perl index 6bedf74..8bf38ee 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1560,7 +1560,9 @@ foreach my $t (@files) { ($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1)); $needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc); + @to = expand_aliases(@to); @to = validate_address_list(sanitize_address_list(@to)); + @cc = expand_aliases(@cc); @cc = validate_address_list(sanitize_address_list(@cc)); @to = (@initial_to, @to); diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index eef12e6..f7d4132 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -1579,6 +1579,66 @@ test_expect_success $PREREQ 'sendemail.aliasfiletype=sendmail' ' grep "^!o@example\.com!$" commandline1 ' +test_expect_success $PREREQ 'alias support in To header' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 --to=sbd >aliased.patch && + git send-email \ + --from="Example " \ + --smtp-server="$(pwd)/fake.sendmail" \ + aliased.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + +test_expect_success $PREREQ 'alias support in Cc header' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 --cc=sbd >aliased.patch && + git send-email \ + --from="Example " \ + --smtp-server="$(pwd)/fake.sendmail" \ + aliased.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + +test_expect_success $PREREQ 'tocmd works with aliases' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 >tocmd.patch && + echo tocmd--sbd >>tocmd.patch && + git send-email \ + --from="Example " \ + --to-cmd=./tocmd-sed \ + --smtp-server="$(pwd)/fake.sendmail" \ + tocmd.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + +test_expect_success $PREREQ 'cccmd works with aliases' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 >cccmd.patch && + echo cccmd--sbd >>cccmd.patch && + git send-email \ + --from="Example " \ + --cc-cmd=./cccmd-sed \ + --smtp-server="$(pwd)/fake.sendmail" \ + cccmd.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + do_xmailer_test () { expected=$1 params=$2 && git format-patch -1 && -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in
[PATCH v5 05/10] send-email: Allow use of aliases in the From field of --compose mode
Aliases were expanded before considering the From field of the --compose option. This is inconsistent with other fields (To, Cc, ...) which already support aliases. Signed-off-by: Remi Lespinet --- git-send-email.perl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index 2d5c530..f61449d 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -555,8 +555,6 @@ if (@alias_files and $aliasfiletype and defined $parse_alias{$aliasfiletype}) { } } -($sender) = expand_aliases($sender) if defined $sender; - # is_format_patch_arg($f) returns 0 if $f names a patch, or 1 if # $f is a revision list specification to be passed to format-patch. sub is_format_patch_arg { @@ -801,6 +799,8 @@ if (!$force) { } } +($sender) = expand_aliases($sender) if defined $sender; + if (!defined $sender) { $sender = $repoauthor || $repocommitter || ''; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in
[PATCH v5 07/10] send-email: reduce dependancies impact on parse_address_line
parse_address_line had not the same behavior whether the user had Mail::Address or not. Teach parse_address_line to behave like Mail::Address. When the user input is correct, this implementation behaves exactly like Mail::Address except when there are quotes inside the name: "Jane Do"e In this case the result of parse_address_line is: With M::A : "Jane Do" e Without : "Jane Do e" When the user input is not correct, the behavior is also mostly the same. Unlike Mail::Address, this doesn't parse groups and recursive commentaries. Signed-off-by: Remi Lespinet --- I've added the function in Git.pm as suggested. I've also added a test named t9000-addresses.sh (I've read the README to name tests but I'm not sure about the name of this test). I made a separated test (t9000-addresses.sh) because I think it's better not to pollute t9001-send-email with this. About the test itself, file t/t9000-addresses.sh is just a copy/paste of t/t0202-gettext-perl.sh. For the perl part, the TODO tests are verbose: they print out commands whereas test_expect_success doesn't. We can redirect todo_output to a variable but I've not found better... (Maybe someone has the solution here ?). Also there's no summary at the end of the test (as with other perl tests). git-send-email.perl | 2 +- perl/Git.pm | 67 + t/t9000-addresses.sh | 25 ++ t/t9000/test.pl | 71 4 files changed, 164 insertions(+), 1 deletion(-) create mode 100755 t/t9000-addresses.sh create mode 100755 t/t9000/test.pl diff --git a/git-send-email.perl b/git-send-email.perl index a0cd7ff..bced78e 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -478,7 +478,7 @@ sub parse_address_line { if ($have_mail_address) { return map { $_->format } Mail::Address->parse($_[0]); } else { - return split_addrs($_[0]); + return Git::parse_mailboxes($_[0]); } } diff --git a/perl/Git.pm b/perl/Git.pm index 9026a7b..97633e9 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -1584,6 +1584,73 @@ sub DESTROY { $self->_close_cat_blob(); } +=item parse_mailboxes + +Returns an array of mailboxes extracted from a string. + +=cut + +sub parse_mailboxes { + my $re_comment = qr/\((?:[^)]*)\)/; + my $re_quote = qr/"(?:[^\"\\]|\\.)*"/; + my $re_word = qr/(?:[^]["\s()<>:;@\\,.]|\\.)+/; + + # divide the string in tokens of the above form + my $re_token = qr/(?:$re_quote|$re_word|$re_comment|\S)/; + my @tokens = map { $_ =~ /\s*($re_token)\s*/g } @_; + + # add a delimiter to simplify treatment for the last mailbox + push @tokens, ","; + + my (@addr_list, @phrase, @address, @comment, @buffer) = (); + foreach my $token (@tokens) { + if ($token =~ /^[,;]$/) { + # if buffer still contains undeterminated strings + # append it at the end of @address or @phrase + if (@address) { + push @address, @buffer; + } else { + push @phrase, @buffer; + } + + my $str_phrase = join ' ', @phrase; + my $str_address = join '', @address; + my $str_comment = join ' ', @comment; + + # quote are necessary if phrase contains + # special characters + if ($str_phrase =~ /[][()<>:;@\\,.\000-\037\177]/) { + $str_phrase =~ s/(^|[^\\])"/$1/g; + $str_phrase = qq["$str_phrase"]; + } + + # add "<>" around the address if necessary + if ($str_address ne "" && $str_phrase ne "") { + $str_address = qq[<$str_address>]; + } + + my $str_mailbox = "$str_phrase $str_address $str_comment"; + $str_mailbox =~ s/^\s*|\s*$//g; + push @addr_list, $str_mailbox if ($str_mailbox); + + @phrase = @address = @comment = @buffer = (); + } elsif ($token =~ /^\(/) { + push @comment, $token; + } elsif ($token eq "<") { + push @phrase, (splice @address), (splice @buffer); + } elsif ($token eq ">") { + push @address, (splice @buffer); + } elsif ($token eq "@") { + push @address,
[PATCH v5 01/10] t9001-send-email: move script creation in a setup test
Move the creation of the scripts used in to-cmd and cc-cmd tests in a setup test to make them available for later tests. Signed-off-by: Remi Lespinet --- t/t9001-send-email.sh | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index a3663da..eef12e6 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -312,13 +312,19 @@ test_expect_success $PREREQ,!AUTOIDENT 'broken implicit ident aborts send-email' ) ' +test_expect_success $PREREQ 'setup tocmd and cccmd scripts' ' + write_script tocmd-sed <<-\EOF && + sed -n -e "s/^tocmd--//p" "$1" + EOF + write_script cccmd-sed <<-\EOF + sed -n -e "s/^cccmd--//p" "$1" + EOF +' + test_expect_success $PREREQ 'tocmd works' ' clean_fake_sendmail && cp $patches tocmd.patch && echo tocmd--to...@example.com >>tocmd.patch && - write_script tocmd-sed <<-\EOF && - sed -n -e "s/^tocmd--//p" "$1" - EOF git send-email \ --from="Example " \ --to-cmd=./tocmd-sed \ @@ -332,9 +338,6 @@ test_expect_success $PREREQ 'cccmd works' ' clean_fake_sendmail && cp $patches cccmd.patch && echo "cccmd-- cc...@example.com" >>cccmd.patch && - write_script cccmd-sed <<-\EOF && - sed -n -e "s/^cccmd--//p" "$1" - EOF git send-email \ --from="Example " \ --to=nob...@example.com \ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in
[PATCH v5 03/10] t9001-send-email: refactor header variable fields replacement
Create a function which replaces Date, Message-Id and X-Mailer lines generated by git-send-email by a specific string: Date:.*$ -> Date: DATE-STRING Message-Id:.*$ -> Message-Id: MESSAGE-ID-STRING X-Mailer:.*$ -> X-Mailer: X-MAILER-STRING Signed-off-by: Remi Lespinet --- t/t9001-send-email.sh | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index f7d4132..714fcae 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -522,6 +522,12 @@ Result: OK EOF " +replace_variable_fields () { + sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \ + -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ + -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" +} + test_suppression () { git send-email \ --dry-run \ @@ -529,10 +535,7 @@ test_suppression () { --from="Example " \ --to=t...@example.com \ --smtp-server relay.example.com \ - $patches | - sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \ - -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ - -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \ + $patches | replace_variable_fields \ >actual-suppress-$1${2+"-$2"} && test_cmp expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"} } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in
[PATCH v5 04/10] send-email: refactor address list process
Simplify code by creating a function which transform a list of strings containing email addresses (separated by commas, comporting aliases) into a clean list of valid email addresses. Signed-off-by: Remi Lespinet --- git-send-email.perl | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index 8bf38ee..2d5c530 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -833,12 +833,9 @@ sub expand_one_alias { return $aliases{$alias} ? expand_aliases(@{$aliases{$alias}}) : $alias; } -@initial_to = expand_aliases(@initial_to); -@initial_to = validate_address_list(sanitize_address_list(@initial_to)); -@initial_cc = expand_aliases(@initial_cc); -@initial_cc = validate_address_list(sanitize_address_list(@initial_cc)); -@bcclist = expand_aliases(@bcclist); -@bcclist = validate_address_list(sanitize_address_list(@bcclist)); +@initial_to = process_address_list(@initial_to); +@initial_cc = process_address_list(@initial_cc); +@bcclist = process_address_list(@bcclist); if ($thread && !defined $initial_reply_to && $prompting) { $initial_reply_to = ask( @@ -1051,6 +1048,13 @@ sub sanitize_address_list { return (map { sanitize_address($_) } @_); } +sub process_address_list { + my @addr_list = expand_aliases(@_); + @addr_list = sanitize_address_list(@addr_list); + @addr_list = validate_address_list(@addr_list); + return @addr_list; +} + # Returns the local Fully Qualified Domain Name (FQDN) if available. # # Tightly configured MTAa require that a caller sends a real DNS @@ -1560,10 +1564,8 @@ foreach my $t (@files) { ($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1)); $needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc); - @to = expand_aliases(@to); - @to = validate_address_list(sanitize_address_list(@to)); - @cc = expand_aliases(@cc); - @cc = validate_address_list(sanitize_address_list(@cc)); + @to = process_address_list(@to); + @cc = process_address_list(@cc); @to = (@initial_to, @to); @cc = (@initial_cc, @cc); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in
[PATCH v5 10/10] send-email: suppress meaningless whitespaces in from field
Remove leading and trailing whitespaces in from field before interepreting it to improve consistency with other options. The split_addrs function already take care of trailing and leading whitespaces for to, cc and bcc fields. The from option now: - has the same behavior when passing arguments like " j...@example.com ", "\t j...@example.com " or "j...@example.com". - interprets aliases in string containing leading and trailing whitespaces such as " alias" or "alias\t" like other options. Signed-off-by: Remi Lespinet --- git-send-email.perl | 1 + t/t9001-send-email.sh | 24 2 files changed, 25 insertions(+) diff --git a/git-send-email.perl b/git-send-email.perl index 8bf6656..749d809 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -786,6 +786,7 @@ if (!$force) { } if (defined $sender) { + $sender =~ s/^\s+|\s+$//g; ($sender) = expand_aliases($sender); } else { $sender = $repoauthor || $repocommitter || ''; diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 3c5b853..8e21fb0 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -1719,4 +1719,28 @@ test_expect_success $PREREQ 'aliases work with email list' ' test_cmp expected-list actual-list ' +test_expect_success $PREREQ 'leading and trailing whitespaces are removed' ' + echo "alias to2 t...@example.com" >.mutt && + echo "alias cc1 Cc 1 " >>.mutt && + test_config sendemail.aliasesfile ".mutt" && + test_config sendemail.aliasfiletype mutt && + TO1=$(echo "QTo 1 " | q_to_tab) && + TO2=$(echo "QZto2" | qz_to_tab_space) && + CC1=$(echo "cc1" | append_cr) && + BCC1=$(echo "Q b...@example.com Q" | q_to_nul) && + git send-email \ + --dry-run \ + --from="Example " \ + --to="$TO1" \ + --to="$TO2" \ + --to=" t...@example.com " \ + --cc="$CC1" \ + --cc="Cc2 " \ + --bcc="$BCC1" \ + --bcc="b...@example.com" \ + 0001-add-master.patch | replace_variable_fields \ + >actual-list && + test_cmp expected-list actual-list +' + test_done -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in
[PATCH v5 09/10] send-email: allow multiple emails using --cc, --to and --bcc
Accept a list of emails separated by commas in flags --cc, --to and --bcc. Multiple addresses can already be given by using these options multiple times, but it is more convenient to allow cutting-and-pasting a list of addresses from the header of an existing e-mail message, which already lists them as comma-separated list, as a value to a single parameter. The following format can now be used: $ git send-email --to='Jane , m...@example.com' Remove the limitation imposed by 79ee555b (Check and document the options to prevent mistakes, 2006-06-21) which rejected every argument with comma in --cc, --to and --bcc. Helped-by: Remi Lespinet Signed-off-by: Mathieu Lienard--Mayor Signed-off-by: Jorge Juan Garcia Garcia Signed-off-by: Matthieu Moy Signed-off-by: Remi Lespinet --- Documentation/git-send-email.txt | 12 +-- git-send-email.perl | 17 ++-- t/t9001-send-email.sh| 44 3 files changed, 52 insertions(+), 21 deletions(-) diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index b48a764..afd9569 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -49,17 +49,17 @@ Composing of 'sendemail.annotate'. See the CONFIGURATION section for 'sendemail.multiEdit'. ---bcc=:: +--bcc=,...:: Specify a "Bcc:" value for each email. Default is the value of 'sendemail.bcc'. + -The --bcc option must be repeated for each user you want on the bcc list. +This option may be specified multiple times. ---cc=:: +--cc=,...:: Specify a starting "Cc:" value for each email. Default is the value of 'sendemail.cc'. + -The --cc option must be repeated for each user you want on the cc list. +This option may be specified multiple times. --compose:: Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1]) @@ -110,13 +110,13 @@ is not set, this will be prompted for. Only necessary if --compose is also set. If --compose is not set, this will be prompted for. ---to=:: +--to=,...:: Specify the primary recipient of the emails generated. Generally, this will be the upstream maintainer of the project involved. Default is the value of the 'sendemail.to' configuration value; if that is unspecified, and --to-cmd is not specified, this will be prompted for. + -The --to option must be repeated for each user you want on the to list. +This option may be specified multiple times. --8bit-encoding=:: When encountering a non-ASCII message or subject that does not diff --git a/git-send-email.perl b/git-send-email.perl index a03392c..8bf6656 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -460,20 +460,6 @@ my ($repoauthor, $repocommitter); ($repoauthor) = Git::ident_person(@repo, 'author'); ($repocommitter) = Git::ident_person(@repo, 'committer'); -# Verify the user input - -foreach my $entry (@initial_to) { - die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/; -} - -foreach my $entry (@initial_cc) { - die "Comma in --cc entry: $entry'\n" unless $entry !~ m/,/; -} - -foreach my $entry (@bcclist) { - die "Comma in --bcclist entry: $entry'\n" unless $entry !~ m/,/; -} - sub parse_address_line { if ($have_mail_address) { return map { $_->format } Mail::Address->parse($_[0]); @@ -1051,7 +1037,8 @@ sub sanitize_address_list { } sub process_address_list { - my @addr_list = expand_aliases(@_); + my @addr_list = map { parse_address_line($_) } @_; + @addr_list = expand_aliases(@addr_list); @addr_list = sanitize_address_list(@addr_list); @addr_list = validate_address_list(@addr_list); return @addr_list; diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 714fcae..3c5b853 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -1675,4 +1675,48 @@ test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=false' ' do_xmailer_test 1 "--xmailer" ' +test_expect_success $PREREQ 'setup expected-list' ' + git send-email \ + --dry-run \ + --from="Example " \ + --to="To 1 " \ + --to="t...@example.com" \ + --to="t...@example.com" \ + --cc="Cc 1 " \ + --cc="Cc2 " \ + --bcc="b...@example.com" \ + --bcc="b...@example.com" \ + 0001-add-master.patch | replace_variable_fields \ + >expected-list +' + +test_expect_success $PREREQ 'use email list in --cc --to and --bcc' ' + git send-email \ + --dry-run \ + --from="Example " \ + --to="To 1 ,
[PATCH v5 08/10] send-email: consider quote as delimiter instead of character
Do not consider quote inside a recipient name as character when they are not escaped. This interprets: "Jane" "Doe" as: "Jane Doe" instead of: "Jane\" \"Doe" Signed-off-by: Remi Lespinet --- git-send-email.perl | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index bced78e..a03392c 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1028,15 +1028,17 @@ sub sanitize_address { return $recipient; } + # remove non-escaped quotes + $recipient_name =~ s/(^|[^\\])"/$1/g; + # rfc2047 is needed if a non-ascii char is included if ($recipient_name =~ /[^[:ascii:]]/) { - $recipient_name =~ s/^"(.*)"$/$1/; $recipient_name = quote_rfc2047($recipient_name); } # double quotes are needed if specials or CTLs are included elsif ($recipient_name =~ /[][()<>@,;:\\".\000-\037\177]/) { - $recipient_name =~ s/(["\\\r])/\\$1/g; + $recipient_name =~ s/([\\\r])/\\$1/g; $recipient_name = qq["$recipient_name"]; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in
[PATCH v5 07/10] send-email: reduce dependancies impact on parse_address_line
Matthieu Moy writes: > This is the last message I received in the series, and it's labeled > 07/10. Is that normal? No, it wasn't, I have seen no error message though... I'll take a look at that later. I just sent 0008, 0009 and 0010 but I seems that I've pasted the wrong line in the in-reply-to... Maybe I need more sleep. >> We can redirect todo_output to a variable but I've not found better... >> (Maybe someone has the solution here ?). Also there's no summary at >> the end of the test (as with other perl tests). > > You can get the 1..44 at the end with ... > I would have put parse_mailbox near ident_person because both > functions are somehow about email. > >> +BEGIN { use_ok('Git') } >> +BEGIN { use_ok('Mail::Address') } > > This will fail if Mail::Address is not available. It would be better > to declare Mail::Address as a prerequisite in t9000-address.sh (like > what you're already doing for Test::More). Ok, will do. Thanks. -- To unsubscribe from this list: send the line "unsubscribe git" in
[PATCH v5 07/10] send-email: reduce dependancies impact on parse_address_line
Matthieu Moy writes: > > We can redirect todo_output to a variable but I've not found better... > > (Maybe someone has the solution here ?). Also there's no summary at > > the end of the test (as with other perl tests). > > You can get the 1..44 at the end with > > printf "1..%d\n", Test::More->builder->current_test; > > This is what t9700/test.pl does. I can also get it by removing the line Test::More->builder->no_ending(1); and replacing use Test::More; by use Test::More "no_plan"; I think I'm going to do that, because the no_ending thing makes the test suite success even if every test fails: at the end we have # test_external test Perl address parsing function was ok # test_external_without_stderr test no stderr: Perl address parsing function was ok in case everything is ok. With the "no_ending" line, only the second line reports failures, the first is always the same. I think both must be marked red. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 01/10] t9001-send-email: move script creation in a setup test
Move the creation of the scripts used in to-cmd and cc-cmd tests in a setup test to make them available for later tests. Signed-off-by: Remi Lespinet --- t/t9001-send-email.sh | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index a3663da..eef12e6 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -312,13 +312,19 @@ test_expect_success $PREREQ,!AUTOIDENT 'broken implicit ident aborts send-email' ) ' +test_expect_success $PREREQ 'setup tocmd and cccmd scripts' ' + write_script tocmd-sed <<-\EOF && + sed -n -e "s/^tocmd--//p" "$1" + EOF + write_script cccmd-sed <<-\EOF + sed -n -e "s/^cccmd--//p" "$1" + EOF +' + test_expect_success $PREREQ 'tocmd works' ' clean_fake_sendmail && cp $patches tocmd.patch && echo tocmd--to...@example.com >>tocmd.patch && - write_script tocmd-sed <<-\EOF && - sed -n -e "s/^tocmd--//p" "$1" - EOF git send-email \ --from="Example " \ --to-cmd=./tocmd-sed \ @@ -332,9 +338,6 @@ test_expect_success $PREREQ 'cccmd works' ' clean_fake_sendmail && cp $patches cccmd.patch && echo "cccmd-- cc...@example.com" >>cccmd.patch && - write_script cccmd-sed <<-\EOF && - sed -n -e "s/^cccmd--//p" "$1" - EOF git send-email \ --from="Example " \ --to=nob...@example.com \ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 03/10] t9001-send-email: refactor header variable fields replacement
Create a function which replaces Date, Message-Id and X-Mailer lines generated by git-send-email by a specific string: Date:.*$ -> Date: DATE-STRING Message-Id:.*$ -> Message-Id: MESSAGE-ID-STRING X-Mailer:.*$ -> X-Mailer: X-MAILER-STRING Signed-off-by: Remi Lespinet --- t/t9001-send-email.sh | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index f7d4132..714fcae 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -522,6 +522,12 @@ Result: OK EOF " +replace_variable_fields () { + sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \ + -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ + -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" +} + test_suppression () { git send-email \ --dry-run \ @@ -529,10 +535,7 @@ test_suppression () { --from="Example " \ --to=t...@example.com \ --smtp-server relay.example.com \ - $patches | - sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \ - -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ - -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \ + $patches | replace_variable_fields \ >actual-suppress-$1${2+"-$2"} && test_cmp expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"} } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 05/10] send-email: Allow use of aliases in the From field of --compose mode
Aliases were expanded before considering the From field of the --compose option. This is inconsistent with other fields (To, Cc, ...) which already support aliases. Signed-off-by: Remi Lespinet --- git-send-email.perl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index 2d5c530..f61449d 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -555,8 +555,6 @@ if (@alias_files and $aliasfiletype and defined $parse_alias{$aliasfiletype}) { } } -($sender) = expand_aliases($sender) if defined $sender; - # is_format_patch_arg($f) returns 0 if $f names a patch, or 1 if # $f is a revision list specification to be passed to format-patch. sub is_format_patch_arg { @@ -801,6 +799,8 @@ if (!$force) { } } +($sender) = expand_aliases($sender) if defined $sender; + if (!defined $sender) { $sender = $repoauthor || $repocommitter || ''; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 06/10] send-email: minor code refactoring
Group expressions in a single if statement. This avoid checking multiple time if the variable $sender is defined. Signed-off-by: Remi Lespinet --- git-send-email.perl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index f61449d..a0cd7ff 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -799,9 +799,9 @@ if (!$force) { } } -($sender) = expand_aliases($sender) if defined $sender; - -if (!defined $sender) { +if (defined $sender) { + ($sender) = expand_aliases($sender); +} else { $sender = $repoauthor || $repocommitter || ''; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 04/10] send-email: refactor address list process
Simplify code by creating a function which transform a list of strings containing email addresses (separated by commas, comporting aliases) into a clean list of valid email addresses. Signed-off-by: Remi Lespinet --- git-send-email.perl | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index 8bf38ee..2d5c530 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -833,12 +833,9 @@ sub expand_one_alias { return $aliases{$alias} ? expand_aliases(@{$aliases{$alias}}) : $alias; } -@initial_to = expand_aliases(@initial_to); -@initial_to = validate_address_list(sanitize_address_list(@initial_to)); -@initial_cc = expand_aliases(@initial_cc); -@initial_cc = validate_address_list(sanitize_address_list(@initial_cc)); -@bcclist = expand_aliases(@bcclist); -@bcclist = validate_address_list(sanitize_address_list(@bcclist)); +@initial_to = process_address_list(@initial_to); +@initial_cc = process_address_list(@initial_cc); +@bcclist = process_address_list(@bcclist); if ($thread && !defined $initial_reply_to && $prompting) { $initial_reply_to = ask( @@ -1051,6 +1048,13 @@ sub sanitize_address_list { return (map { sanitize_address($_) } @_); } +sub process_address_list { + my @addr_list = expand_aliases(@_); + @addr_list = sanitize_address_list(@addr_list); + @addr_list = validate_address_list(@addr_list); + return @addr_list; +} + # Returns the local Fully Qualified Domain Name (FQDN) if available. # # Tightly configured MTAa require that a caller sends a real DNS @@ -1560,10 +1564,8 @@ foreach my $t (@files) { ($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1)); $needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc); - @to = expand_aliases(@to); - @to = validate_address_list(sanitize_address_list(@to)); - @cc = expand_aliases(@cc); - @cc = validate_address_list(sanitize_address_list(@cc)); + @to = process_address_list(@to); + @cc = process_address_list(@cc); @to = (@initial_to, @to); @cc = (@initial_cc, @cc); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 07/10] send-email: reduce dependencies impact on parse_address_line
parse_address_line had not the same behavior whether the user had Mail::Address or not. Teach parse_address_line to behave like Mail::Address. When the user input is correct, this implementation behaves exactly like Mail::Address except when there are quotes inside the name: "Jane Do"e In this case the result of parse_address_line is: With M::A : "Jane Do" e Without : "Jane Do e" When the user input is not correct, the behavior is also mostly the same. Unlike Mail::Address, this doesn't parse groups and recursive commentaries. Signed-off-by: Remi Lespinet --- git-send-email.perl | 2 +- perl/Git.pm | 67 t/t9000-addresses.sh | 30 +++ t/t9000/test.pl | 67 4 files changed, 165 insertions(+), 1 deletion(-) create mode 100755 t/t9000-addresses.sh create mode 100755 t/t9000/test.pl diff --git a/git-send-email.perl b/git-send-email.perl index a0cd7ff..bced78e 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -478,7 +478,7 @@ sub parse_address_line { if ($have_mail_address) { return map { $_->format } Mail::Address->parse($_[0]); } else { - return split_addrs($_[0]); + return Git::parse_mailboxes($_[0]); } } diff --git a/perl/Git.pm b/perl/Git.pm index 9026a7b..19ef081 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -864,6 +864,73 @@ sub ident_person { return "$ident[0] <$ident[1]>"; } +=item parse_mailboxes + +Return an array of mailboxes extracted from a string. + +=cut + +sub parse_mailboxes { + my $re_comment = qr/\((?:[^)]*)\)/; + my $re_quote = qr/"(?:[^\"\\]|\\.)*"/; + my $re_word = qr/(?:[^]["\s()<>:;@\\,.]|\\.)+/; + + # divide the string in tokens of the above form + my $re_token = qr/(?:$re_quote|$re_word|$re_comment|\S)/; + my @tokens = map { $_ =~ /\s*($re_token)\s*/g } @_; + + # add a delimiter to simplify treatment for the last mailbox + push @tokens, ","; + + my (@addr_list, @phrase, @address, @comment, @buffer) = (); + foreach my $token (@tokens) { + if ($token =~ /^[,;]$/) { + # if buffer still contains undeterminated strings + # append it at the end of @address or @phrase + if (@address) { + push @address, @buffer; + } else { + push @phrase, @buffer; + } + + my $str_phrase = join ' ', @phrase; + my $str_address = join '', @address; + my $str_comment = join ' ', @comment; + + # quote are necessary if phrase contains + # special characters + if ($str_phrase =~ /[][()<>:;@\\,.\000-\037\177]/) { + $str_phrase =~ s/(^|[^\\])"/$1/g; + $str_phrase = qq["$str_phrase"]; + } + + # add "<>" around the address if necessary + if ($str_address ne "" && $str_phrase ne "") { + $str_address = qq[<$str_address>]; + } + + my $str_mailbox = "$str_phrase $str_address $str_comment"; + $str_mailbox =~ s/^\s*|\s*$//g; + push @addr_list, $str_mailbox if ($str_mailbox); + + @phrase = @address = @comment = @buffer = (); + } elsif ($token =~ /^\(/) { + push @comment, $token; + } elsif ($token eq "<") { + push @phrase, (splice @address), (splice @buffer); + } elsif ($token eq ">") { + push @address, (splice @buffer); + } elsif ($token eq "@") { + push @address, (splice @buffer), "@"; + } elsif ($token eq ".") { + push @address, (splice @buffer), "."; + } else { + push @buffer, $token; + } + } + + return @addr_list; +} =item hash_object ( TYPE, FILENAME ) diff --git a/t/t9000-addresses.sh b/t/t9000-addresses.sh new file mode 100755 index 000..7223d03 --- /dev/null +++ b/t/t9000-addresses.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Copyright (c) 2015 +# + +test_description='compare address parsing with and without Mail::Address' +. ./test-lib.sh + +if ! test_have_prereq PERL; then + skip_all='skipping perl interface
[PATCH v6 02/10] send-email: allow aliases in patch header and command script outputs
Interpret aliases in: - Header fields of patches generated by git format-patch (using --to, --cc, --add-header for example) or manually modified. Example of fields in header: To: alias1 Cc: alias2 Cc: alias3 - Outputs of command scripts specified by --cc-cmd and --to-cmd. Example of script: #!/bin/sh echo alias1 echo alias2 Signed-off-by: Remi Lespinet --- git-send-email.perl | 2 ++ t/t9001-send-email.sh | 60 +++ 2 files changed, 62 insertions(+) diff --git a/git-send-email.perl b/git-send-email.perl index 6bedf74..8bf38ee 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1560,7 +1560,9 @@ foreach my $t (@files) { ($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1)); $needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc); + @to = expand_aliases(@to); @to = validate_address_list(sanitize_address_list(@to)); + @cc = expand_aliases(@cc); @cc = validate_address_list(sanitize_address_list(@cc)); @to = (@initial_to, @to); diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index eef12e6..f7d4132 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -1579,6 +1579,66 @@ test_expect_success $PREREQ 'sendemail.aliasfiletype=sendmail' ' grep "^!o@example\.com!$" commandline1 ' +test_expect_success $PREREQ 'alias support in To header' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 --to=sbd >aliased.patch && + git send-email \ + --from="Example " \ + --smtp-server="$(pwd)/fake.sendmail" \ + aliased.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + +test_expect_success $PREREQ 'alias support in Cc header' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 --cc=sbd >aliased.patch && + git send-email \ + --from="Example " \ + --smtp-server="$(pwd)/fake.sendmail" \ + aliased.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + +test_expect_success $PREREQ 'tocmd works with aliases' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 >tocmd.patch && + echo tocmd--sbd >>tocmd.patch && + git send-email \ + --from="Example " \ + --to-cmd=./tocmd-sed \ + --smtp-server="$(pwd)/fake.sendmail" \ + tocmd.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + +test_expect_success $PREREQ 'cccmd works with aliases' ' + clean_fake_sendmail && + echo "alias sbd some...@example.org" >.mailrc && + test_config sendemail.aliasesfile ".mailrc" && + test_config sendemail.aliasfiletype mailrc && + git format-patch --stdout -1 >cccmd.patch && + echo cccmd--sbd >>cccmd.patch && + git send-email \ + --from="Example " \ + --cc-cmd=./cccmd-sed \ + --smtp-server="$(pwd)/fake.sendmail" \ + cccmd.patch \ + 2>errors >out && + grep "^!someone@example\.org!$" commandline1 +' + do_xmailer_test () { expected=$1 params=$2 && git format-patch -1 && -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 08/10] send-email: consider quote as delimiter instead of character
Do not consider quote inside a recipient name as character when they are not escaped. This interprets: "Jane" "Doe" as: "Jane Doe" instead of: "Jane\" \"Doe" Signed-off-by: Remi Lespinet --- git-send-email.perl | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index bced78e..a03392c 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1028,15 +1028,17 @@ sub sanitize_address { return $recipient; } + # remove non-escaped quotes + $recipient_name =~ s/(^|[^\\])"/$1/g; + # rfc2047 is needed if a non-ascii char is included if ($recipient_name =~ /[^[:ascii:]]/) { - $recipient_name =~ s/^"(.*)"$/$1/; $recipient_name = quote_rfc2047($recipient_name); } # double quotes are needed if specials or CTLs are included elsif ($recipient_name =~ /[][()<>@,;:\\".\000-\037\177]/) { - $recipient_name =~ s/(["\\\r])/\\$1/g; + $recipient_name =~ s/([\\\r])/\\$1/g; $recipient_name = qq["$recipient_name"]; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 09/10] send-email: allow multiple emails using --cc, --to and --bcc
Accept a list of emails separated by commas in flags --cc, --to and --bcc. Multiple addresses can already be given by using these options multiple times, but it is more convenient to allow cutting-and-pasting a list of addresses from the header of an existing e-mail message, which already lists them as comma-separated list, as a value to a single parameter. The following format can now be used: $ git send-email --to='Jane , m...@example.com' Remove the limitation imposed by 79ee555b (Check and document the options to prevent mistakes, 2006-06-21) which rejected every argument with comma in --cc, --to and --bcc. Helped-by: Remi Lespinet Signed-off-by: Mathieu Lienard--Mayor Signed-off-by: Jorge Juan Garcia Garcia Signed-off-by: Matthieu Moy Signed-off-by: Remi Lespinet --- Documentation/git-send-email.txt | 12 +-- git-send-email.perl | 17 ++-- t/t9001-send-email.sh| 44 3 files changed, 52 insertions(+), 21 deletions(-) diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index b48a764..afd9569 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -49,17 +49,17 @@ Composing of 'sendemail.annotate'. See the CONFIGURATION section for 'sendemail.multiEdit'. ---bcc=:: +--bcc=,...:: Specify a "Bcc:" value for each email. Default is the value of 'sendemail.bcc'. + -The --bcc option must be repeated for each user you want on the bcc list. +This option may be specified multiple times. ---cc=:: +--cc=,...:: Specify a starting "Cc:" value for each email. Default is the value of 'sendemail.cc'. + -The --cc option must be repeated for each user you want on the cc list. +This option may be specified multiple times. --compose:: Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1]) @@ -110,13 +110,13 @@ is not set, this will be prompted for. Only necessary if --compose is also set. If --compose is not set, this will be prompted for. ---to=:: +--to=,...:: Specify the primary recipient of the emails generated. Generally, this will be the upstream maintainer of the project involved. Default is the value of the 'sendemail.to' configuration value; if that is unspecified, and --to-cmd is not specified, this will be prompted for. + -The --to option must be repeated for each user you want on the to list. +This option may be specified multiple times. --8bit-encoding=:: When encountering a non-ASCII message or subject that does not diff --git a/git-send-email.perl b/git-send-email.perl index a03392c..8bf6656 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -460,20 +460,6 @@ my ($repoauthor, $repocommitter); ($repoauthor) = Git::ident_person(@repo, 'author'); ($repocommitter) = Git::ident_person(@repo, 'committer'); -# Verify the user input - -foreach my $entry (@initial_to) { - die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/; -} - -foreach my $entry (@initial_cc) { - die "Comma in --cc entry: $entry'\n" unless $entry !~ m/,/; -} - -foreach my $entry (@bcclist) { - die "Comma in --bcclist entry: $entry'\n" unless $entry !~ m/,/; -} - sub parse_address_line { if ($have_mail_address) { return map { $_->format } Mail::Address->parse($_[0]); @@ -1051,7 +1037,8 @@ sub sanitize_address_list { } sub process_address_list { - my @addr_list = expand_aliases(@_); + my @addr_list = map { parse_address_line($_) } @_; + @addr_list = expand_aliases(@addr_list); @addr_list = sanitize_address_list(@addr_list); @addr_list = validate_address_list(@addr_list); return @addr_list; diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 714fcae..3c5b853 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -1675,4 +1675,48 @@ test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=false' ' do_xmailer_test 1 "--xmailer" ' +test_expect_success $PREREQ 'setup expected-list' ' + git send-email \ + --dry-run \ + --from="Example " \ + --to="To 1 " \ + --to="t...@example.com" \ + --to="t...@example.com" \ + --cc="Cc 1 " \ + --cc="Cc2 " \ + --bcc="b...@example.com" \ + --bcc="b...@example.com" \ + 0001-add-master.patch | replace_variable_fields \ + >expected-list +' + +test_expect_success $PREREQ 'use email list in --cc --to and --bcc' ' + git send-email \ + --dry-run \ + --from="Example " \ + --to="To 1 ,
[PATCH v6 10/10] send-email: suppress meaningless whitespaces in from field
Remove leading and trailing whitespaces in from field before interepreting it to improve consistency with other options. The split_addrs function already take care of trailing and leading whitespaces for to, cc and bcc fields. The from option now: - has the same behavior when passing arguments like " j...@example.com ", "\t j...@example.com " or "j...@example.com". - interprets aliases in string containing leading and trailing whitespaces such as " alias" or "alias\t" like other options. Signed-off-by: Remi Lespinet --- git-send-email.perl | 1 + t/t9001-send-email.sh | 24 2 files changed, 25 insertions(+) diff --git a/git-send-email.perl b/git-send-email.perl index 8bf6656..749d809 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -786,6 +786,7 @@ if (!$force) { } if (defined $sender) { + $sender =~ s/^\s+|\s+$//g; ($sender) = expand_aliases($sender); } else { $sender = $repoauthor || $repocommitter || ''; diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 3c5b853..8e21fb0 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -1719,4 +1719,28 @@ test_expect_success $PREREQ 'aliases work with email list' ' test_cmp expected-list actual-list ' +test_expect_success $PREREQ 'leading and trailing whitespaces are removed' ' + echo "alias to2 t...@example.com" >.mutt && + echo "alias cc1 Cc 1 " >>.mutt && + test_config sendemail.aliasesfile ".mutt" && + test_config sendemail.aliasfiletype mutt && + TO1=$(echo "QTo 1 " | q_to_tab) && + TO2=$(echo "QZto2" | qz_to_tab_space) && + CC1=$(echo "cc1" | append_cr) && + BCC1=$(echo "Q b...@example.com Q" | q_to_nul) && + git send-email \ + --dry-run \ + --from="Example " \ + --to="$TO1" \ + --to="$TO2" \ + --to=" t...@example.com " \ + --cc="$CC1" \ + --cc="Cc2 " \ + --bcc="$BCC1" \ + --bcc="b...@example.com" \ + 0001-add-master.patch | replace_variable_fields \ + >actual-list && + test_cmp expected-list actual-list +' + test_done -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 07/10] send-email: reduce dependencies impact on parse_address_line
Matthieu Moy writes: > Your git send-email does not seem to like PATCHes 08-10/10 ;-). > > Up to PATCH 07, the series looks good. Yes, I get "Too many recipients" error... If I specify --no-signoff-by-cc then this is also aborted but I get no error (at least I've not seen it last time...). If I rerun git send-email with only one patch, it works (even if there is no difference with the number of recipient a priori). I'll investigate asap, not sure it's a bug, maybe It's just me ! -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v7 07/10] send-email: reduce dependencies impact on parse_address_line
> I'd vote for keeping it simple and not having the copyright notice. Most > t/*.sh do not have one. The Git history + mailing-list archives are much > better than in-code comments to keep track of who wrote what. > Remi: any objection on removing it? Sorry for not having resent the patches myself, I currently have no Internet access, neither at work nor at home... Here's a try on my phone: I though the copyright line was necessary, but I did not know what to write after, and I forgot to ask, so I'm really happy with simply removing it. :) Thanks! -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html