Skip to contentSkip to conversation

send-email: squelch warning due to comparing undefined $_ to ""

PATCH In review Jay Soffian 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 send-email: squelch warning due to comparing undefined $_ to ""

The check to see if initial_reply_to is defined was also comparing $_ to "" for a reason I cannot ascertain (looking at the commit which made the change didn't provide enlightenment), but if $_ is undefined, perl generates a warning.

---
Junio, the commit which introduced the change was yours, but I don't see why you were comparing $_ to "".

http://repo.or.cz/w/git.git?a=commit;h=ace9c2a9dd7c9e54194998fc6b7c677dbb7d0902

 git-send-email.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
git-send-email.perl +1 -1
index 59601e3..ccb87a2 100755
@@ -475,7 +475,7 @@ if ($thread && !defined $initial_reply_to && $prompting) {
 
 	$initial_reply_to = $_;
 }
-if (defined $initial_reply_to && $_ ne "") {
+if (defined $initial_reply_to) {
 	$initial_reply_to =~ s/^\s*<?/</;
 	$initial_reply_to =~ s/>?\s*$/>/;
 }
Signature · 1 line
1.5.4.2.208.gfb302
#1 lore raw
Quoted 9 lines · Jay Soffian

The check to see if initial_reply_to is defined was also comparing $_ to "" for a reason I cannot ascertain (looking at the commit which made the change didn't provide enlightenment), but if $_ is undefined, perl generates a warning.

---
Junio, the commit which introduced the change was yours, but I don't see why you were comparing $_ to "".

I think it was meant to check for $initial_reply_to being empty (i.e. not compare $_ but the variable), but even if that is the case I do not think the check would make a difference.

So the patch looks good. Thanks.