Re: [PATCH v6] Add a remote helper to interact with mediawiki (fetch & push)
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 1, 2011, 00:24 UTC
- Message-ID
- <7vobz5xg7u.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <vpq7h5tbia6.fsf@bauges.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 10 quoted lines
> Here:
>
> + for my $refspec (@refsspecs) {
> + unless ($refspec =~ m/^(\+?)([^:]*):([^:]*)$/) {
> + die("Invalid refspec for push. Expected <src>:<dst> or +<src>:<dst>");
> + }
> + my ($force, $local, $remote) = ($1 eq "+", $2, $3);
>
> At this point, $force is a boolean saying whether there were a +, and
> $local and $remote are as you can guess.It may be slightly more Perl-ish to hoist the "0-or-1" outside the group and rely on $1 becoming undef, like this:
my ($force, $local, $remote) = $refspec =~ /^(\+)?([^:]*):([^:]*)$/ or die(...);
Even though it largely is a matter of taste, I think.