Subject: Re: [PATCH] Allow multiple tag and branch directories in git-svnimport

From: [email-masked] (Randal L. Schwartz)
Date: Tue, 21 Aug 2007 10:46:23 -0700

>>>>> "Stefan" == Stefan Sperling <[email-masked]> writes:

Stefan> On Tue, Aug 21, 2007 at 07:08:58PM +0200, Stefan Sperling wrote:
>> +my @tag_dirs = defined $opt_t ? split /:/,$opt_t : "tags";
Stefan>       ^                                                ^^^^^
>> +my @branch_dirs = defined $opt_b ? split /:/,$opt_b : "branches";
Stefan>       ^                                                  ^^^^^^^^^^

Stefan> Ouch, just noticed it's a bad idea to try to initialise
Stefan> an array with a scalar. Sorry :-/

That's completely normal.  Perl predictably promotes the single scalar to an
array of one element.  I wouldn't have even noticed it in a detailed code
review, since it's so normal to do that.

In fact, the parens that you added do *not* make it a list.  The parens
are purely for precedence in:

    @a = (3, 5, 7);

because otherwise, the text:

    @a = 3, 5, 7;

would be parsed as:

    (@a = 3), 5, 7;

which would be pretty pointless.  It's the *comma* in a list context that
makes it a list.

So, your parens are not only uncommon, they are also completely ineffective,
similar to replacing 2 + 3 with (2) + (3) :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[email-masked]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!