Skip to content

Commit 68cedb1

Browse files
jnarebgitster
authored andcommitted
gitweb: Use block form of map/grep in a few cases more
Use block form of 'grep' i.e. 'grep {BLOCK} LIST' rather than 'grep(EXPR, LIST)' in filter_snapshot_fmts subroutine. This makes code more readable, as expression is rather long, and statement above there is 'map' with very similar expression also in the block form. Remove unnecessary and misleading parentheses around block form 'map' arguments in quote_command subroutine. The inner "map" in format_snapshot_links was left alone, as it is not clear whether adding parentheses or changing it into block form would improve readibility and clarity of this code. Signed-off-by: Jakub Narebski <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 34122b5 commit 68cedb1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gitweb/gitweb.perl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,8 @@ sub filter_snapshot_fmts {
458458
@fmts = map {
459459
exists $known_snapshot_format_aliases{$_} ?
460460
$known_snapshot_format_aliases{$_} : $_} @fmts;
461-
@fmts = grep(exists $known_snapshot_formats{$_}, @fmts);
462-
461+
@fmts = grep {
462+
exists $known_snapshot_formats{$_} } @fmts;
463463
}
464464

465465
our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
@@ -1838,7 +1838,7 @@ sub git_cmd {
18381838
# Try to avoid using this function wherever possible.
18391839
sub quote_command {
18401840
return join(' ',
1841-
map( { my $a = $_; $a =~ s/(['!])/'\\$1'/g; "'$a'" } @_ ));
1841+
map { my $a = $_; $a =~ s/(['!])/'\\$1'/g; "'$a'" } @_ );
18421842
}
18431843

18441844
# get HEAD ref of given project as hash

0 commit comments

Comments
 (0)