Re: [PATCH 3/3] gitweb: Few doublequoted strings cleanups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jakub Narebski <jnareb@xxxxxxxxx> writes:

> Replace a few doublequoted strings by theirs singlequoted equivalent,
> lose doublequotes around variable in string containing only
> of a variable name, use '' consistently as an empty string (and not
> sometimes as "").

Why?  I do not in particular like a micro-cleanup like this (it
seems more of personal taste than cleanup).

> -	} elsif ($char eq "\\") {
> +	} elsif ($char eq '\\') {
>  		$diff_class = " incomplete";
>  	}

Especially this makes a shell scripter think twice before
realizing that this is Perl and a backslash expands inside
single quotes.  In other words, I find that the former is easier
to read.

> @@ -1052,7 +1052,7 @@ sub git_get_projects_list {
>  		my $dir = $projects_list . ($filter ? "/$filter" : '');
>  		# remove the trailing "/"
>  		$dir =~ s!/+$!!;
> -		my $pfxlen = length("$dir");
> +		my $pfxlen = length($dir);

On the other hand, I think this makes the code easier to read.

> @@ -1261,7 +1261,7 @@ sub parse_tag {
>  		} elsif ($line =~ m/--BEGIN/) {
>  			push @comment, $line;
>  			last;

One thing I noticed is that we seem to have needless 'm' as in
the above m/--BEGIN/ in some places.  My preferences are (this
falls within "personal taste" category):

 * Unless the pattern has slashes, drop 'm' for match, always
   use '|' as the delimiter for substitution s/A/B;

 * If the pattern has slashes, consistently use the same
   alternate letter as the delimiter (gitweb seems to use '!').


> @@ -3616,7 +3616,7 @@ sub git_snapshot {
>  
>  	print $cgi->header(
>  		-type => "application/$ctype",
> -		-content_disposition => 'inline; filename="' . "$filename" . '"',
> +		-content_disposition => 'inline; filename="' . $filename . '"',
>  		-status => '200 OK');
>  

Wouldn't it be easier to read if we did

	"inline; filename=\"$filename\""

instead?

-
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]