Thread (4 messages) flat view 4 messages, 3 authors, 2016-06-15

Re: [PATCH v5 2/5] gitweb: add project_filter to limit project list to a subdirectory

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:52:53

Possibly related (same subject, not in this thread)

On Mon, 30 Jan 2012, Junio C Hamano wrote:
"Bernhard R. Link" [off-list ref] writes:
quoted
I'll resend the series as replies to this mail.
Thanks; I'll queue them in 'pu' for now (if Jakub wants to Ack the pieces,
I'll amend them).
You can add Ack from me for the whole series.
quoted hunk ↗ jump to hunk
Regarding the first patch in the series, while it may be a valid perl to
introduce a new variable, assign to it and then munge its contents with
s///, all inside a parameter list of a function call, it is doing a bit
too much and makes it hard to see if the variable may or may not later be
used in the same scope (in this case, it is not).

I am tempted to squash the following in.
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b764d51..f215eaa 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -6003,7 +6003,8 @@ sub git_forks {
 		die_error(400, "Unknown order parameter");
 	}
 
-	my @list = git_get_projects_list((my $filter = $project) =~ s/\.git$//);
+	my ($filter = $project) =~ s/\.git$//;
This doesn't work: it is syntax error:

  Can't declare scalar assignment in "my"
  
It has to be either

 +	(my $filter = $project) =~ s/\.git$//;

or

 +	my $filter = $project;
 +	$filter =~ s/\.git$//;

-- 
Jakub Narebski
Poland
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help