Subject: Re: [PATCH v2 10/11] gitweb: add HEAD to list of shortlog refs if detached

From: Jakub Narebski <[email-masked]>
Date: Sun, 16 Nov 2008 00:59:39 +0100

On Fri, 14 Nov 2008, Giuseppe Bilotta wrote:

> Subject: [PATCH v2 10/11] gitweb: add HEAD to list of shortlog refs if detached

Errr... what?!?

It is not "list of shortlog refs", it is list of _ref markers_.

> Signed-off-by: Giuseppe Bilotta <[email-masked]>
> ---
>  gitweb/gitweb.perl |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index ceb0271..256c962 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -2296,6 +2296,10 @@ sub git_get_last_activity {
>  sub git_get_references {
>  	my $type = shift || "";
>  	my %refs;
> +	if (git_is_head_detached()) {
> +		my $hash = git_get_head_hash($project);

+	if ($hash = git_is_head_detached()) {

if using provided (in response to previous patch) implementation, but
even that can be simplified out by using "git show-ref -h ...";
see below

> +		$refs{$hash} = [ 'HEAD' ];
> +	}

Overly complicated. The '-h'/'--head' option to git-show-ref is there
for a reason.

>  	# 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c refs/tags/v2.6.11
>  	# c39ae07f393806ccf406ef966e9a15afc43cc36a refs/tags/v2.6.11^{}
>  	open my $fd, "-|", git_cmd(), "show-ref", "--dereference",
>		($type ? ("--", "refs/$type") : ()) # use -- <pattern> if $type

-		($type ? ("--", "refs/$type") : ()) # use -- <pattern> if $type
+		($type ? ("--", "refs/$type") : ('-h')) # use -- <pattern> if $type

>		or return;

This is I think simpler.

-- 
Jakub Narebski
Poland