Junio C Hamano <gitster@xxxxxxxxx> writes: > Matthieu Moy <Matthieu.Moy@xxxxxxxxxxxxxxx> writes: > >> 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(...); Thanks, I didn't know I could do this. -- Matthieu Moy http://www-verimag.imag.fr/~moy/ -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html