git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jakub Narebski <jnareb@gmail.com>
Date
Nov 15, 2008, 23:59 UTC
Message-ID
<200811160059.40402.jnareb@gmail.com>
In-Reply-To
<1226620461-25168-1-git-send-email-giuseppe.bilotta@gmail.com>
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_.
Show 15 quoted lines
> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
> ---
>  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
Previous: Jakub NarebskiNext: Junio C Hamano
Message 14 of 46 in “gitweb: display remote heads”
  1. 00/11 gitweb: display remote headsGiuseppe Bilotta, Nov 13, 2008
  2. 01/11 gitweb: introduce remote_heads featureGiuseppe Bilotta, Nov 13, 2008
  3. 02/11 gitweb: git_get_heads_list accepts an optional list of refs.Giuseppe Bilotta, Nov 13, 2008
  4. 03/11 gitweb: separate heads and remotes list in summary viewGiuseppe Bilotta, Nov 13, 2008
  5. 04/11 gitweb: optional custom name for refs in git_heads_bodyGiuseppe Bilotta, Nov 13, 2008
  6. 05/11 gitweb: git_split_heads_body function.Giuseppe Bilotta, Nov 13, 2008
  7. 06/11 gitweb: use CSS to style split head lists.Giuseppe Bilotta, Nov 13, 2008
  8. 07/11 gitweb: add 'remotes' actionGiuseppe Bilotta, Nov 13, 2008
  9. 08/11 gitweb: display HEAD in heads list when detachedGiuseppe Bilotta, Nov 13, 2008
  10. 09/11 gitweb: git_is_head_detached() functionGiuseppe Bilotta, Nov 13, 2008
  11. 10/11 gitweb: add HEAD to list of shortlog refs if detachedGiuseppe Bilotta, Nov 13, 2008
  12. 11/11 gitweb: CSS style and refs mark for detached HEADGiuseppe Bilotta, Nov 13, 2008
  13. Jakub NarebskiNov 16, 2008
  14. Jakub NarebskiNov 15, 2008
  15. Junio C HamanoNov 14, 2008
  16. Giuseppe BilottaNov 14, 2008
  17. Junio C HamanoNov 14, 2008
  18. Nanako ShiraishiNov 14, 2008
  19. Jakub NarebskiNov 15, 2008
  20. Jakub NarebskiNov 15, 2008
  21. Jakub NarebskiNov 15, 2008
  22. Giuseppe BilottaNov 15, 2008
  23. Jakub NarebskiNov 16, 2008
  24. Giuseppe BilottaNov 16, 2008
  25. Jakub NarebskiNov 15, 2008
  26. Jakub NarebskiNov 14, 2008
  27. Giuseppe BilottaNov 15, 2008
  28. Jakub NarebskiNov 16, 2008
  29. Giuseppe BilottaNov 16, 2008
  30. Junio C HamanoNov 15, 2008
  31. Giuseppe BilottaNov 15, 2008
  32. Jakub NarebskiNov 16, 2008
  33. Giuseppe BilottaNov 16, 2008
  34. Jakub NarebskiNov 16, 2008
  35. Giuseppe BilottaNov 16, 2008
  36. Jakub NarebskiNov 14, 2008
  37. Giuseppe BilottaNov 15, 2008
  38. Jakub NarebskiNov 14, 2008
  39. Giuseppe BilottaNov 14, 2008
  40. Jakub NarebskiNov 14, 2008
  41. Giuseppe BilottaNov 14, 2008
  42. Jakub NarebskiNov 14, 2008
  43. Giuseppe BilottaNov 14, 2008
  44. Jakub NarebskiNov 14, 2008
  45. Sverre RabbelierNov 14, 2008
  46. Giuseppe BilottaNov 14, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.