Re: [PATCH 02/14] gitweb: make remote heads in heads list optional

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

 



Giuseppe Bilotta <giuseppe.bilotta@xxxxxxxxx> writes:

> +sub feature_remote_heads {
> +	my ($val) = git_get_project_config('remote_heads', '--bool');
> +
> +	if ($val eq 'true') {
> +		return (1);
> +	} elsif ($val eq 'false') {
> +		return (0);
> +	}
> +
> +	return ($_[0]);
> +}
> +

I do not think the parentheses around the return values buy you
anything, other than patch readers to wonder "Huh?  Is there
anything special going on here?"

> @@ -2060,10 +2084,12 @@ sub git_get_heads_list {
>  	my $limit = shift;
>  	my @headslist;
>  
> +	my ($remote_heads) = gitweb_check_feature('remote_heads');
> +
>  	open my $fd, '-|', git_cmd(), 'for-each-ref',
>  		($limit ? '--count='.($limit+1) : ()), '--sort=-committerdate',
>  		'--format=%(objectname) %(refname) %(subject)%00%(committer)',
> -		'refs/heads', 'refs/remotes'
> +		'refs/heads', ( $remote_heads ? 'refs/remotes' : '')
>  		or return;

This runs "git for-each-ref $others ''" which happens to be Ok
for for-each-ref, but just to make sure other people do not
emulate this and get bitten, I'd prefer to see it written like
this:

-		'refs/heads', 'refs/remotes'
+		'refs/heads', ( $remote_heads ? 'refs/remotes' : ())

-
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]

  Powered by Linux