Skip to contentSkip to conversation

Test cccmd in t9001-send-email.sh and fix two bugs

PATCH RESEND Superseded Paolo Bonzini 3 participants 5 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 Test cccmd in t9001-send-email.sh and fix two bugs

For another patch series I'm working on I needed some tests for the cc-cmd feature of git-send-email.

This patch adds 3 tests for the feature, and fixes two bugs. The first bug is that the --suppress-cc option for cccmd' was misspelled as ccmd' in the code. The second bug, which is actually found only with my other series, is that the argument to the cccmd is never quoted, so the cccmd would fail with patch file names containing a space.

I also test the possibility to specify --suppress-cc multiple times.

---
 git-send-email.perl   |    4 +-
 t/t9001-send-email.sh |   80 +++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 77 insertions(+), 7 deletions(-)

The patch was sent first a week ago with no remarks.

git-send-email.perl +2 -2
index 303e03a..7ae1f29 100755
@@ -334,7 +334,7 @@ if (@suppress_cc) {
 }
 
 if ($suppress_cc{'all'}) {
-	foreach my $entry (qw (ccmd cc author self sob body bodycc)) {
+	foreach my $entry (qw (cccmd cc author self sob body bodyccc)) {
 		$suppress_cc{$entry} = 1;
 	}
 	delete $suppress_cc{'all'};
@@ -1104,7 +1104,7 @@ foreach my $t (@files) {
 	close F;
 
 	if (defined $cc_cmd && !$suppress_cc{'cccmd'}) {
-		open(F, "$cc_cmd $t |")
+		open(F, "$cc_cmd \Q$t\E |")
 			or die "(cc-cmd) Could not execute '$cc_cmd'";
 		while(<F>) {
 			my $c = $_;
t/t9001-send-email.sh +75 -5

127 lines not on this page · raw message

Signature · 1 line
1.6.0.3
#1 lore raw

Paolo Bonzini, 17.06.2009:

git-send-email.perl if (@suppress_cc) { · line 337

Quoted 10 lines

The first bug is that the --suppress-cc option for cccmd' was misspelled as ccmd' in the code.

+++ b/git-send-email.perl

git-send-email.perl +1 -1
@@ -334,7 +334,7 @@ if (@suppress_cc) {
 }
 
 if ($suppress_cc{'all'}) {
-	foreach my $entry (qw (ccmd cc author self sob body bodycc)) {
+	foreach my $entry (qw (cccmd cc author self sob body bodyccc)) {

Additionally you incorrectly changed bodycc to bodyccc.

Then I noticed that the documentation mentions ccbody, but the code uses bodycc.
The author seemed to intend using bodycc, since it is also used in the tests and the commit message (3531e2703d, send-email: --suppress-cc improvements, 2009-02-15), but besides the documentation, ccbody is used in the bash completion.

Quoted 3 lines
git-send-email.perl +0 -0
 		$suppress_cc{$entry} = 1;
 	}
 	delete $suppress_cc{'all'};
#2 lore raw

PATCH v2 1/1 Test cccmd in t9001-send-email.sh and fix some bugs

For another patch series I'm working on I needed some tests for the cc-cmd feature of git-send-email.

This patch adds 3 tests for the feature and for the possibility to specify --suppress-cc multiple times, and fixes two bugs. The first bug is that the --suppress-cc option for cccmd' was misspelled as ccmd' in the code. The second bug, which is actually found only with my other series, is that the argument to the cccmd is never quoted, so the cccmd would fail with patch file names containing a space.

A third bug I fix (in the docs) is that the bodycc argument was actually spelled ccbody in the documentation and bash completion.

Cc Markus Heidelberg <[email protected]>
---
 Documentation/git-send-email.txt       |    4 +-
 contrib/completion/git-completion.bash |    2 +-
 git-send-email.perl                    |    4 +-
 t/t9001-send-email.sh                  |   80 ++++++++++++++++++++++++++++++--
 4 files changed, 80 insertions(+), 10 deletions(-)

Thanks Markus for noticing my erroneous change and the inconsistency in the docs.

Documentation/git-send-email.txt +2 -2
index 9902da4..fbde2d3 100644
@@ -193,12 +193,12 @@ Automating
 - 'self' will avoid including the sender
 - 'cc' will avoid including anyone mentioned in Cc lines in the patch header
   except for self (use 'self' for that).
-- 'ccbody' will avoid including anyone mentioned in Cc lines in the
+- 'bodycc' will avoid including anyone mentioned in Cc lines in the
   patch body (commit message) except for self (use 'self' for that).
 - 'sob' will avoid including anyone mentioned in Signed-off-by lines except
    for self (use 'self' for that).
 - 'cccmd' will avoid running the --cc-cmd.
-- 'body' is equivalent to 'sob' + 'ccbody'
+- 'body' is equivalent to 'sob' + 'bodycc'
 - 'all' will suppress all auto cc values.
 --
 +
contrib/completion/git-completion.bash +1 -1
index 80ab4e4..b60cb68 100755
@@ -1299,7 +1299,7 @@ _git_rebase ()
 }
 
 __git_send_email_confirm_options="always never auto cc compose"
-__git_send_email_suppresscc_options="author self cc ccbody sob cccmd body all"
+__git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all"
 
 _git_send_email ()
 {
git-send-email.perl +2 -2
index 303e03a..8ce6f1f 100755
@@ -334,7 +334,7 @@ if (@suppress_cc) {
 }
 
 if ($suppress_cc{'all'}) {
-	foreach my $entry (qw (ccmd cc author self sob body bodycc)) {
+	foreach my $entry (qw (cccmd cc author self sob body bodycc)) {
 		$suppress_cc{$entry} = 1;
 	}
 	delete $suppress_cc{'all'};
@@ -1104,7 +1104,7 @@ foreach my $t (@files) {
 	close F;
 
 	if (defined $cc_cmd && !$suppress_cc{'cccmd'}) {
-		open(F, "$cc_cmd $t |")
+		open(F, "$cc_cmd \Q$t\E |")
 			or die "(cc-cmd) Could not execute '$cc_cmd'";
 		while(<F>) {
 			my $c = $_;
t/t9001-send-email.sh +75 -5

127 lines not on this page · raw message

Signature · 1 line
1.6.0.3
#3 lore raw

Re: [PATCH v2] Test cccmd in t9001-send-email.sh and fix some bugs

Paolo Bonzini, 18.06.2009:

Quoted 2 lines

For another patch series I'm working on I needed some tests for the cc-cmd feature of git-send-email.

I think this is text for a cover-letter.

Quoted 10 lines

This patch adds 3 tests for the feature and for the possibility to specify --suppress-cc multiple times, and fixes two bugs. The first bug is that the --suppress-cc option for cccmd' was misspelled as ccmd' in the code. The second bug, which is actually found only with my other series, is that the argument to the cccmd is never quoted, so the cccmd would fail with patch file names containing a space.

A third bug I fix (in the docs) is that the bodycc argument was actually spelled ccbody in the documentation and bash completion.

And these three unrelated bug fixes should rather go into three separate patches.

Quoted 11 lines
Cc Markus Heidelberg <[email protected]>
---
 Documentation/git-send-email.txt       |    4 +-
 contrib/completion/git-completion.bash |    2 +-
 git-send-email.perl                    |    4 +-
 t/t9001-send-email.sh                  |   80 ++++++++++++++++++++++++++++++--
 4 files changed, 80 insertions(+), 10 deletions(-)

Thanks Markus for noticing my erroneous change and the inconsistency in the docs.

This normally goes directly under ---
I didn't notice it before the second look.

#4 lore raw
In reply to Markus Heidelberg
Quoted 3 lines · Markus Heidelberg

Paolo Bonzini, 17.06.2009:

Quoted 2 lines

The first bug is that the --suppress-cc option for cccmd' was misspelled as ccmd' in the code.

Good catch. That error has actually existed since --suppress-cc was introduced in 65648283. But nor did I (sheesh, aren't many eyes supposed to make all bugs shallow?) catch it in 3531e2703d.

Quoted 6 lines

Then I noticed that the documentation mentions ccbody, but the code uses bodycc.
The author seemed to intend using bodycc, since it is also used in the tests and the commit message (3531e2703d, send-email: --suppress-cc improvements, 2009-02-15), but besides the documentation, ccbody is used in the bash completion.

Wow, I'm pretty sure I intended bodycc. And I'm not even dyslexic.

Thanks,

j.