git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Randal L. Schwartz <merlyn@stonehenge.com>
Date
Aug 21, 2007, 17:46 UTC
Message-ID
<86wsvook5s.fsf@blue.stonehenge.com>
In-Reply-To
<20070821173838.GC1721@jack.stsp.lan>
>>>>> "Stefan" == Stefan Sperling <stsp@elego.de> 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
<merlyn@stonehenge.com> <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!
Previous: Stefan SperlingNext: Stefan Sperling
Message 3 of 4 in “Allow multiple tag and branch directories in git-svnimport”
  1. Allow multiple tag and branch directories in git-svnimportStefan Sperling, Aug 21, 2007
  2. Stefan SperlingAug 21, 2007
  3. Randal L. SchwartzAug 21, 2007
  4. Stefan SperlingAug 22, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.