{"thread":{"id":"16322","subject":"[PATCH v2 10/11] gitweb: add HEAD to list of shortlog refs if detached","startedAt":"2008-11-13T22:49:06Z","lastAt":"2008-11-16T15:28:08Z","messageCount":46,"participants":["Giuseppe Bilotta","Junio C Hamano","Jakub Narebski","Sverre Rabbelier","Nanako Shiraishi"],"isPatch":true,"patchVersion":2,"patchTotal":11},"messages":[{"id":"95984","messageId":"1226616555-24503-1-git-send-email-giuseppe.bilotta@gmail.com","threadId":"16322","inReplyTo":null,"subject":"[PATCH v2 00/11] gitweb: display remote heads","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-13T22:49:06Z","receivedAt":"2008-11-13T22:49:06Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"This is a patchset I presented about a year ago or so, but after a lively\ndiscussion it dropped into silence. I'm now presenting it again, with minor\ncleanups and adjustements.\n\nGiuseppe Bilotta (11):\n  gitweb: introduce remote_heads feature\n  gitweb: git_get_heads_list accepts an optional list of refs.\n  gitweb: separate heads and remotes list in summary view\n  gitweb: optional custom name for refs in git_heads_body\n  gitweb: git_split_heads_body function.\n  gitweb: use CSS to style split head lists.\n  gitweb: add 'remotes' action\n  gitweb: display HEAD in heads list when detached\n  gitweb: git_is_head_detached() function\n  gitweb: add HEAD to list of shortlog refs if detached\n  gitweb: CSS style and refs mark for detached HEAD\n\n gitweb/gitweb.css  |   15 ++++++\n gitweb/gitweb.perl |  138 ++++++++++++++++++++++++++++++++++++++++++++++++----\n 2 files changed, 143 insertions(+), 10 deletions(-)\n"},{"id":"95985","messageId":"1226616555-24503-2-git-send-email-giuseppe.bilotta@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-1-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH v2 01/11] gitweb: introduce remote_heads feature","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-13T22:49:07Z","receivedAt":"2008-11-13T22:49:07Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"With this feature enabled, remotes are retrieved (and displayed)\nwhen getting (and displaying) the heads list.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n gitweb/gitweb.perl |   31 +++++++++++++++++++++++++++++--\n 1 files changed, 29 insertions(+), 2 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 933e137..b6c4233 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -327,6 +327,18 @@ our %feature = (\n \t'ctags' => {\n \t\t'override' => 0,\n \t\t'default' => [0]},\n+\n+\t# Make gitweb show remotes too in the heads list\n+\n+\t# To enable system wide have in $GITWEB_CONFIG\n+\t# $feature{'remote_heads'}{'default'} = [1];\n+\t# To have project specific config enable override in $GITWEB_CONFIG\n+\t# $feature{'remote_heads'}{'override'} = 1;\n+\t# and in project config gitweb.remote_heads = 0|1;\n+\t'remote_heads' => {\n+\t\t'sub' => \\&feature_remote_heads,\n+\t\t'override' => 0,\n+\t\t'default' => [0]},\n );\n \n sub gitweb_check_feature {\n@@ -392,6 +404,18 @@ sub feature_pickaxe {\n \treturn ($_[0]);\n }\n \n+sub feature_remote_heads {\n+\tmy ($val) = git_get_project_config('remote_heads', '--bool');\n+\n+\tif ($val eq 'true') {\n+\t\treturn (1);\n+\t} elsif ($val eq 'false') {\n+\t\treturn (0);\n+\t}\n+\n+\treturn ($_[0]);\n+}\n+\n # checking HEAD file with -e is fragile if the repository was\n # initialized long time ago (i.e. symlink HEAD) and was pack-ref'ed\n # and then pruned.\n@@ -2642,10 +2666,12 @@ sub git_get_heads_list {\n \tmy $limit = shift;\n \tmy @headslist;\n \n+\tmy ($remote_heads) = gitweb_check_feature('remote_heads');\n+\n \topen my $fd, '-|', git_cmd(), 'for-each-ref',\n \t\t($limit ? '--count='.($limit+1) : ()), '--sort=-committerdate',\n \t\t'--format=%(objectname) %(refname) %(subject)%00%(committer)',\n-\t\t'refs/heads'\n+\t\t'refs/heads', ( $remote_heads ? 'refs/remotes' : '')\n \t\tor return;\n \twhile (my $line = <$fd>) {\n \t\tmy %ref_item;\n@@ -2656,8 +2682,9 @@ sub git_get_heads_list {\n \t\tmy ($committer, $epoch, $tz) =\n \t\t\t($committerinfo =~ /^(.*) ([0-9]+) (.*)$/);\n \t\t$ref_item{'fullname'}  = $name;\n-\t\t$name =~ s!^refs/heads/!!;\n+\t\t$name =~ s!^refs/(head|remote)s/!!;\n \n+\t\t$ref_item{'class'} = $1;\n \t\t$ref_item{'name'}  = $name;\n \t\t$ref_item{'id'}    = $hash;\n \t\t$ref_item{'title'} = $title || '(no commit message)';\n-- \n1.5.6.5\n"},{"id":"95988","messageId":"1226616555-24503-3-git-send-email-giuseppe.bilotta@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-2-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH v2 02/11] gitweb: git_get_heads_list accepts an optional list of refs.","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-13T22:49:08Z","receivedAt":"2008-11-13T22:49:08Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"git_get_heads_list(limit, dir1, dir2, ...) can now be used to retrieve\nrefs/dir1, refs/dir2 etc. Defaults to ('heads') or ('heads', 'remotes')\ndepending on the remote_heads option.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n gitweb/gitweb.perl |   11 +++++++----\n 1 files changed, 7 insertions(+), 4 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex b6c4233..d7c97a3 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2663,15 +2663,18 @@ sub parse_from_to_diffinfo {\n ## parse to array of hashes functions\n \n sub git_get_heads_list {\n-\tmy $limit = shift;\n+\tmy ($limit, @class) = @_;\n+\tunless (defined @class) {\n+\t\tmy ($remote_heads) = gitweb_check_feature('remote_heads');\n+\t\t@class = ('heads', $remote_heads ? 'remotes' : undef);\n+\t}\n+\tmy @refs = map { \"refs/$_\" } @class;\n \tmy @headslist;\n \n-\tmy ($remote_heads) = gitweb_check_feature('remote_heads');\n-\n \topen my $fd, '-|', git_cmd(), 'for-each-ref',\n \t\t($limit ? '--count='.($limit+1) : ()), '--sort=-committerdate',\n \t\t'--format=%(objectname) %(refname) %(subject)%00%(committer)',\n-\t\t'refs/heads', ( $remote_heads ? 'refs/remotes' : '')\n+\t\t@refs\n \t\tor return;\n \twhile (my $line = <$fd>) {\n \t\tmy %ref_item;\n-- \n1.5.6.5\n"},{"id":"95987","messageId":"1226616555-24503-4-git-send-email-giuseppe.bilotta@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-3-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH v2 03/11] gitweb: separate heads and remotes list in summary view","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-13T22:49:09Z","receivedAt":"2008-11-13T22:49:09Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n gitweb/gitweb.perl |   11 ++++++++++-\n 1 files changed, 10 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex d7c97a3..ab29aec 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -4449,6 +4449,7 @@ sub git_summary {\n \tmy %co = parse_commit(\"HEAD\");\n \tmy %cd = %co ? parse_date($co{'committer_epoch'}, $co{'committer_tz'}) : ();\n \tmy $head = $co{'id'};\n+\tmy ($remote_heads) = gitweb_check_feature('remote_heads');\n \n \tmy $owner = git_get_project_owner($project);\n \n@@ -4456,7 +4457,8 @@ sub git_summary {\n \t# These get_*_list functions return one more to allow us to see if\n \t# there are more ...\n \tmy @taglist  = git_get_tags_list(16);\n-\tmy @headlist = git_get_heads_list(16);\n+\tmy @headlist = git_get_heads_list(16, 'heads');\n+\tmy @remotelist = $remote_heads ? git_get_heads_list(16, 'remotes') : ();\n \tmy @forklist;\n \tmy ($check_forks) = gitweb_check_feature('forks');\n \n@@ -4535,6 +4537,13 @@ sub git_summary {\n \t\t               $cgi->a({-href => href(action=>\"heads\")}, \"...\"));\n \t}\n \n+\tif (@remotelist) {\n+\t\tgit_print_header_div('remotes');\n+\t\tgit_heads_body(\\@remotelist, $head, 0, 15,\n+\t\t               $#remotelist <= 15 ? undef :\n+\t\t               $cgi->a({-href => href(action=>\"heads\")}, \"...\"));\n+\t}\n+\n \tif (@forklist) {\n \t\tgit_print_header_div('forks');\n \t\tgit_project_list_body(\\@forklist, 'age', 0, 15,\n-- \n1.5.6.5\n"},{"id":"95986","messageId":"1226616555-24503-5-git-send-email-giuseppe.bilotta@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-4-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH v2 04/11] gitweb: optional custom name for refs in git_heads_body","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-13T22:49:10Z","receivedAt":"2008-11-13T22:49:10Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"We make a clear separation between the hash reference and the displayed\nname for refs displayed by git_heads_body. This can be used e.g. to\ngroup them and display only the distinct part of the name.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n gitweb/gitweb.perl |   12 +++++++-----\n 1 files changed, 7 insertions(+), 5 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex ab29aec..a736f2a 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -4288,16 +4288,18 @@ sub git_heads_body {\n \t\t} else {\n \t\t\tprint \"<tr class=\\\"light\\\">\\n\";\n \t\t}\n+\t\tmy $hname = $ref{'hname'} || $ref{'fullname'} || $ref{'name'};\n+\t\tmy $name = $ref{'name'};\n \t\t$alternate ^= 1;\n \t\tprint \"<td><i>$ref{'age'}</i></td>\\n\" .\n \t\t      ($curr ? \"<td class=\\\"current_head\\\">\" : \"<td>\") .\n-\t\t      $cgi->a({-href => href(action=>\"shortlog\", hash=>$ref{'fullname'}),\n-\t\t               -class => \"list name\"},esc_html($ref{'name'})) .\n+\t\t      $cgi->a({-href => href(action=>\"shortlog\", hash=>$hname),\n+\t\t               -class => \"list name\"},esc_html($name)) .\n \t\t      \"</td>\\n\" .\n \t\t      \"<td class=\\\"link\\\">\" .\n-\t\t      $cgi->a({-href => href(action=>\"shortlog\", hash=>$ref{'fullname'})}, \"shortlog\") . \" | \" .\n-\t\t      $cgi->a({-href => href(action=>\"log\", hash=>$ref{'fullname'})}, \"log\") . \" | \" .\n-\t\t      $cgi->a({-href => href(action=>\"tree\", hash=>$ref{'fullname'}, hash_base=>$ref{'name'})}, \"tree\") .\n+\t\t      $cgi->a({-href => href(action=>\"shortlog\", hash=>$hname)}, \"shortlog\") . \" | \" .\n+\t\t      $cgi->a({-href => href(action=>\"log\", hash=>$hname)}, \"log\") . \" | \" .\n+\t\t      $cgi->a({-href => href(action=>\"tree\", hash=>$hname, hash_base=>$hname)}, \"tree\") .\n \t\t      \"</td>\\n\" .\n \t\t      \"</tr>\";\n \t}\n-- \n1.5.6.5\n"},{"id":"95990","messageId":"1226616555-24503-6-git-send-email-giuseppe.bilotta@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-5-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH v2 05/11] gitweb: git_split_heads_body function.","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-13T22:49:11Z","receivedAt":"2008-11-13T22:49:11Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"The purpose of this function is to split a headlist into groups\ndetermined by the leading part of the refname, and call git_heads_body()\non each group.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n gitweb/gitweb.perl |   33 ++++++++++++++++++++++++++++++++-\n 1 files changed, 32 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex a736f2a..836b6ba 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -4271,6 +4271,37 @@ sub git_tags_body {\n \tprint \"</table>\\n\";\n }\n \n+sub git_split_heads_body {\n+\tmy ($headlist, $head, $from, $to, $extra) = @_;\n+\tmy %headlists;\n+\tmy $leader; my $list; my @list;\n+\n+\t# Split @$headlist into a hash of lists\n+\tmap {\n+\t\tmy %ref = %$_;\n+\t\t$ref{'hname'} = $ref{'name'};\n+\t\tif ($ref{'name'} =~ /\\//) {\n+\t\t\t$ref{'name'} =~ s!^([^/]+)/!!;\n+\t\t\t$leader = $1;\n+\t\t} else {\n+\t\t\t$leader = \"\\000\";\n+\t\t}\n+\t\tif (defined $headlists{$leader}) {\n+\t\t\t@list = @{$headlists{$leader}}\n+\t\t} else {\n+\t\t\t@list = ()\n+\t\t}\n+\t\tpush @list, \\%ref;\n+\t\t$headlists{$leader} = [@list];\n+\t} @$headlist;\n+\n+\tforeach $leader (sort(keys %headlists)) {\n+\t\tprint \"<b>$leader</b><br/>\\n\" unless $leader eq \"\\000\";\n+\t\t$list = $headlists{$leader};\n+\t\tgit_heads_body($list, $head, $from, $to, $extra);\n+\t}\n+}\n+\n sub git_heads_body {\n \t# uses global variable $project\n \tmy ($headlist, $head, $from, $to, $extra) = @_;\n@@ -4541,7 +4572,7 @@ sub git_summary {\n \n \tif (@remotelist) {\n \t\tgit_print_header_div('remotes');\n-\t\tgit_heads_body(\\@remotelist, $head, 0, 15,\n+\t\tgit_split_heads_body(\\@remotelist, $head, 0, 15,\n \t\t               $#remotelist <= 15 ? undef :\n \t\t               $cgi->a({-href => href(action=>\"heads\")}, \"...\"));\n \t}\n-- \n1.5.6.5\n"},{"id":"95992","messageId":"1226616555-24503-7-git-send-email-giuseppe.bilotta@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-6-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH v2 06/11] gitweb: use CSS to style split head lists.","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-13T22:49:12Z","receivedAt":"2008-11-13T22:49:12Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"Introduce a new div class 'subsection' in the CSS and use it to style\nsplit head lists.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n gitweb/gitweb.css  |   10 ++++++++++\n gitweb/gitweb.perl |    4 +++-\n 2 files changed, 13 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.css b/gitweb/gitweb.css\nindex a01eac8..751749f 100644\n--- a/gitweb/gitweb.css\n+++ b/gitweb/gitweb.css\n@@ -8,6 +8,16 @@ body {\n \tcolor: #000000;\n }\n \n+div.subsection {\n+\tborder: solid #d9d8d1;\n+\tborder-width: 1px;\n+\tmargin: 10px;\n+}\n+\n+.subsection .title {\n+\tfont-size: smaller;\n+}\n+\n a {\n \tcolor: #0000cc;\n }\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 836b6ba..03e0b21 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -4296,9 +4296,11 @@ sub git_split_heads_body {\n \t} @$headlist;\n \n \tforeach $leader (sort(keys %headlists)) {\n-\t\tprint \"<b>$leader</b><br/>\\n\" unless $leader eq \"\\000\";\n+\t\tprint \"<div class=\\\"subsection\\\">\\n\";\n+\t\tgit_print_header_div(undef, $leader) unless $leader eq \"\\000\";\n \t\t$list = $headlists{$leader};\n \t\tgit_heads_body($list, $head, $from, $to, $extra);\n+\t\tprint \"</div>\\n\";\n \t}\n }\n \n-- \n1.5.6.5\n"},{"id":"95993","messageId":"1226616555-24503-8-git-send-email-giuseppe.bilotta@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-7-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH v2 07/11] gitweb: add 'remotes' action","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-13T22:49:13Z","receivedAt":"2008-11-13T22:49:13Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"This action is similar to the 'heads' action, but it displays\nremote heads, grouped by remote repository.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n gitweb/gitweb.perl |   16 +++++++++++++++-\n 1 files changed, 15 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 03e0b21..09728cb 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -507,6 +507,7 @@ our %actions = (\n \t\"commit\" => \\&git_commit,\n \t\"forks\" => \\&git_forks,\n \t\"heads\" => \\&git_heads,\n+\t\"remotes\" => \\&git_remotes,\n \t\"history\" => \\&git_history,\n \t\"log\" => \\&git_log,\n \t\"rss\" => \\&git_rss,\n@@ -4755,13 +4756,26 @@ sub git_heads {\n \tgit_print_page_nav('','', $head,undef,$head);\n \tgit_print_header_div('summary', $project);\n \n-\tmy @headslist = git_get_heads_list();\n+\tmy @headslist = git_get_heads_list(undef, 'heads');\n \tif (@headslist) {\n \t\tgit_heads_body(\\@headslist, $head);\n \t}\n \tgit_footer_html();\n }\n \n+sub git_remotes {\n+\tmy $head = git_get_head_hash($project);\n+\tgit_header_html();\n+\tgit_print_page_nav('','', $head,undef,$head);\n+\tgit_print_header_div('summary', $project . ' remotes');\n+\n+\tmy @headslist = git_get_heads_list(undef, 'remotes');\n+\tif (@headslist) {\n+\t\tgit_split_heads_body(\\@headslist, $head);\n+\t}\n+\tgit_footer_html();\n+}\n+\n sub git_blob_plain {\n \tmy $type = shift;\n \tmy $expires;\n-- \n1.5.6.5\n"},{"id":"95989","messageId":"1226616555-24503-9-git-send-email-giuseppe.bilotta@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-8-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH v2 08/11] gitweb: display HEAD in heads list when detached","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-13T22:49:14Z","receivedAt":"2008-11-13T22:49:14Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n gitweb/gitweb.perl |   21 +++++++++++++++++++++\n 1 files changed, 21 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 09728cb..a168f6f 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2672,6 +2672,27 @@ sub git_get_heads_list {\n \tmy @refs = map { \"refs/$_\" } @class;\n \tmy @headslist;\n \n+\tif (grep { $_ eq 'heads' } @class) {\n+\t\tmy @x = (git_cmd(), 'branch');\n+\t\tmy @ret = split(\"\\n\", qx(@x));\n+\t\tif (grep { /^\\* \\(no branch\\)$/ } @ret) { ;\n+\t\t\tmy %ref_item;\n+\t\t\t@x = (git_cmd(), 'log', '-1', '--pretty=format:%H%n%ct%n%s');\n+\t\t\tmy ($hash, $epoch, $title) = split(\"\\n\", qx(@x), 3);\n+\n+\t\t\t$ref_item{'class'} = 'head';\n+\t\t\t$ref_item{'name'} = 'HEAD';\n+\t\t\t$ref_item{'id'} = $hash;\n+\t\t\t$ref_item{'title'} = $title || '(no commit message)';\n+\t\t\tif ($ref_item{'epoch'} = $epoch) {\n+\t\t\t\t$ref_item{'age'} = age_string(time - $ref_item{'epoch'});\n+\t\t\t} else {\n+\t\t\t\t$ref_item{'age'} = \"unknown\";\n+\t\t\t}\n+\t\t\tpush @headslist, \\%ref_item;\n+\t\t}\n+\t}\n+\n \topen my $fd, '-|', git_cmd(), 'for-each-ref',\n \t\t($limit ? '--count='.($limit+1) : ()), '--sort=-committerdate',\n \t\t'--format=%(objectname) %(refname) %(subject)%00%(committer)',\n-- \n1.5.6.5\n"},{"id":"95991","messageId":"1226616555-24503-10-git-send-email-giuseppe.bilotta@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-9-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH v2 09/11] gitweb: git_is_head_detached() function","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-13T22:49:15Z","receivedAt":"2008-11-13T22:49:15Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"The function checks if the HEAD for the current project is detached by\nchecking if 'git branch' returns \"* (no branch)\"\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n gitweb/gitweb.perl |   13 +++++++++----\n 1 files changed, 9 insertions(+), 4 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex a168f6f..ceb0271 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1844,6 +1844,13 @@ sub git_get_head_hash {\n \treturn $retval;\n }\n \n+# check if current HEAD is detached\n+sub git_is_head_detached {\n+\tmy @x = (git_cmd(), 'branch');\n+\tmy @ret = split(\"\\n\", qx(@x));\n+\treturn 0 + grep { /^\\* \\(no branch\\)$/ } @ret;\n+}\n+\n # get type of given object\n sub git_get_type {\n \tmy $hash = shift;\n@@ -2673,11 +2680,9 @@ sub git_get_heads_list {\n \tmy @headslist;\n \n \tif (grep { $_ eq 'heads' } @class) {\n-\t\tmy @x = (git_cmd(), 'branch');\n-\t\tmy @ret = split(\"\\n\", qx(@x));\n-\t\tif (grep { /^\\* \\(no branch\\)$/ } @ret) { ;\n+\t\tif (git_is_head_detached()) {\n \t\t\tmy %ref_item;\n-\t\t\t@x = (git_cmd(), 'log', '-1', '--pretty=format:%H%n%ct%n%s');\n+\t\t\tmy @x = (git_cmd(), 'log', '-1', '--pretty=format:%H%n%ct%n%s');\n \t\t\tmy ($hash, $epoch, $title) = split(\"\\n\", qx(@x), 3);\n \n \t\t\t$ref_item{'class'} = 'head';\n-- \n1.5.6.5\n"},{"id":"95743","messageId":"1226620461-25168-1-git-send-email-giuseppe.bilotta@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-10-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH v2 10/11] gitweb: add HEAD to list of shortlog refs if detached","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-13T23:54:20Z","receivedAt":"2008-11-13T23:54:20Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n gitweb/gitweb.perl |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex ceb0271..256c962 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2296,6 +2296,10 @@ sub git_get_last_activity {\n sub git_get_references {\n \tmy $type = shift || \"\";\n \tmy %refs;\n+\tif (git_is_head_detached()) {\n+\t\tmy $hash = git_get_head_hash($project);\n+\t\t$refs{$hash} = [ 'HEAD' ];\n+\t}\n \t# 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c refs/tags/v2.6.11\n \t# c39ae07f393806ccf406ef966e9a15afc43cc36a refs/tags/v2.6.11^{}\n \topen my $fd, \"-|\", git_cmd(), \"show-ref\", \"--dereference\",\n-- \n1.5.6.5\n"},{"id":"95744","messageId":"1226620461-25168-2-git-send-email-giuseppe.bilotta@gmail.com","threadId":"16322","inReplyTo":"1226620461-25168-1-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH v2 11/11] gitweb: CSS style and refs mark for detached HEAD","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-13T23:54:21Z","receivedAt":"2008-11-13T23:54:21Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n gitweb/gitweb.css  |    5 +++++\n gitweb/gitweb.perl |    2 +-\n 2 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.css b/gitweb/gitweb.css\nindex 751749f..c0c4540 100644\n--- a/gitweb/gitweb.css\n+++ b/gitweb/gitweb.css\n@@ -523,6 +523,11 @@ span.refs span.head {\n \tborder-color: #ccffcc #00cc33 #00cc33 #ccffcc;\n }\n \n+span.refs span.detached {\n+\tbackground-color: #ffaaaa;\n+\tborder-color: #ccffcc #00cc33 #00cc33 #ccffcc;\n+}\n+\n span.atnight {\n \tcolor: #cc0000;\n }\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 256c962..51e133d 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2298,7 +2298,7 @@ sub git_get_references {\n \tmy %refs;\n \tif (git_is_head_detached()) {\n \t\tmy $hash = git_get_head_hash($project);\n-\t\t$refs{$hash} = [ 'HEAD' ];\n+\t\t$refs{$hash} = [ 'detached/HEAD' ];\n \t}\n \t# 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c refs/tags/v2.6.11\n \t# c39ae07f393806ccf406ef966e9a15afc43cc36a refs/tags/v2.6.11^{}\n-- \n1.5.6.5\n"},{"id":"95766","messageId":"7vk5b6dd3t.fsf@gitster.siamese.dyndns.org","threadId":"16322","inReplyTo":"1226616555-24503-10-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH v2 09/11] gitweb: git_is_head_detached() function","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-11-14T06:40:38Z","receivedAt":"2008-11-14T06:40:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:\n\n> The function checks if the HEAD for the current project is detached by\n> checking if 'git branch' returns \"* (no branch)\"\n\nThis one looks more like \"oops, the way detached HEAD is detected in 08 is\nsucky, let's cover it up by introducing a function as an afterthought.\"\n\nHave a patch that introduces git_is_head_detached() first, and then use\nthat function to implement the feature.  I personally think the user (that\nis, 08/11) is small and isolated enough that these two can be a single\npatch.\n\n> +# check if current HEAD is detached\n> +sub git_is_head_detached {\n> +\tmy @x = (git_cmd(), 'branch');\n> +\tmy @ret = split(\"\\n\", qx(@x));\n> +\treturn 0 + grep { /^\\* \\(no branch\\)$/ } @ret;\n> +}\n\nDo not read from Porcelain in scripts.\n\n\"git symbolic-ref HEAD\" should error out when your HEAD is detached, and\nwill return refs/heads/frotz when you are on frotz branch.\n\nBut realistically speaking, what does it mean to have a detached HEAD in a\nrepository published via gitweb?  First of all these things are supposed\nto be bare and there would be no checkout.\n"},{"id":"95771","messageId":"cb7bb73a0811140052h1b7aac6cp6b0b376fa59548a9@mail.gmail.com","threadId":"16322","inReplyTo":"7vk5b6dd3t.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v2 09/11] gitweb: git_is_head_detached() function","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-14T08:52:09Z","receivedAt":"2008-11-14T08:52:09Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Fri, Nov 14, 2008 at 7:40 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:\n>\n>> The function checks if the HEAD for the current project is detached by\n>> checking if 'git branch' returns \"* (no branch)\"\n>\n> This one looks more like \"oops, the way detached HEAD is detected in 08 is\n> sucky, let's cover it up by introducing a function as an afterthought.\"\n\nHalf and half: it _is_ an afterthought, and although it's sucky that's\nnot the reason why I decided to refactor it 8-)\n\n> Have a patch that introduces git_is_head_detached() first, and then use\n> that function to implement the feature.  I personally think the user (that\n> is, 08/11) is small and isolated enough that these two can be a single\n> patch.\n\nWill do. I did some patch squashing while preparing this set, but I\nforgot to do this one.\n\n>> +# check if current HEAD is detached\n>> +sub git_is_head_detached {\n>> +     my @x = (git_cmd(), 'branch');\n>> +     my @ret = split(\"\\n\", qx(@x));\n>> +     return 0 + grep { /^\\* \\(no branch\\)$/ } @ret;\n>> +}\n>\n> Do not read from Porcelain in scripts.\n>\n> \"git symbolic-ref HEAD\" should error out when your HEAD is detached, and\n> will return refs/heads/frotz when you are on frotz branch.\n\nEh, I was, like, 100% sure this was the wrong way to do it, but I\ndidn't have any idea on how to do it using the plumbing. Thanks, I'll\nlook into that.\n\n> But realistically speaking, what does it mean to have a detached HEAD in a\n> repository published via gitweb?  First of all these things are supposed\n> to be bare and there would be no checkout.\n\nYou know what's funny, when I first started working on the 'show\nremote branches in gitweb' patchset, you had a similar objection, but\nas you yourself pointed out\n\n> But obviously people use gitweb/instaweb as a way to view their\n> own live repository, and I think it makes sense to show and\n> support remotes/ in such a case.  It also would make sense to\n> support detached HEAD there as well.\n\nhttp://kerneltrap.org/mailarchive/git/2007/8/30/256411\n\nand that's exactly the reason why I added the part about the detached head 8-)\n\nI have been thinking about making this detached HEAD thing an\nadditional option, but it _really_ seemed like overkill.\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"95790","messageId":"200811141533.15427.jnareb@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-1-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH v2 00/11] gitweb: display remote heads","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-11-14T14:33:14Z","receivedAt":"2008-11-14T14:33:14Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Thu, 13 Nov 2008, Giuseppe Bilotta wrote:\n\n> This is a patchset I presented about a year ago or so, but after a lively\n> discussion it dropped into silence. I'm now presenting it again, with minor\n> cleanups and adjustements.\n\nThat is very nice of you to resend this series. If you could provide\nlink to earlier discussion of this series...\n \n> Giuseppe Bilotta (11):\n>   gitweb: introduce remote_heads feature\n>   gitweb: git_get_heads_list accepts an optional list of refs.\n>   gitweb: separate heads and remotes list in summary view\n>   gitweb: optional custom name for refs in git_heads_body\n>   gitweb: git_split_heads_body function.\n>   gitweb: use CSS to style split head lists.\n>   gitweb: add 'remotes' action\n>   gitweb: display HEAD in heads list when detached\n>   gitweb: git_is_head_detached() function\n>   gitweb: add HEAD to list of shortlog refs if detached\n>   gitweb: CSS style and refs mark for detached HEAD\n\nI'll try to review individual patches, but I haven't examined them\nyet, so perhaps there is a reason why there are so many patches in\nthis series?\n\n\nNote that on GMane NNTP (news) interface I can see only two last\npatches. Could anyone not CC-ed confirm or deny if this is VGER\nanti-SPAM filter at work, or some GMane archive hiccup?\n\n-- \nJakub Narebski\nPoland\n"},{"id":"95795","messageId":"bd6139dc0811140725m37cbcd9erd61e21048f0def2f@mail.gmail.com","threadId":"16322","inReplyTo":"200811141533.15427.jnareb@gmail.com","subject":"Re: [PATCH v2 00/11] gitweb: display remote heads","fromName":"Sverre Rabbelier","fromEmail":"alturin@gmail.com","sentAt":"2008-11-14T15:25:21Z","receivedAt":"2008-11-14T15:25:21Z","isPatch":true,"sender":{"key":"alturin@gmail.com","avatar":null},"body":"On Fri, Nov 14, 2008 at 15:33, Jakub Narebski <jnareb@gmail.com> wrote:\n> Note that on GMane NNTP (news) interface I can see only two last\n> patches. Could anyone not CC-ed confirm or deny if this is VGER\n> anti-SPAM filter at work, or some GMane archive hiccup?\n\nI got all of the patches just fine, and I'm not CC-ed ;).\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"95804","messageId":"7vk5b69p87.fsf@gitster.siamese.dyndns.org","threadId":"16322","inReplyTo":"cb7bb73a0811140052h1b7aac6cp6b0b376fa59548a9@mail.gmail.com","subject":"Re: [PATCH v2 09/11] gitweb: git_is_head_detached() function","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-11-14T17:44:40Z","receivedAt":"2008-11-14T17:44:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Giuseppe Bilotta\" <giuseppe.bilotta@gmail.com> writes:\n\n> I have been thinking about making this detached HEAD thing an\n> additional option, but it _really_ seemed like overkill.\n\nI agree that it does not make much sense to make this feature an option.\nDetaching the HEAD in the repository itself is an enough clue from the\nuser to the code that the user wants to trigger the feature.\n\nThanks.\n"},{"id":"95809","messageId":"200811141915.17680.jnareb@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-2-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH v2 01/11] gitweb: introduce remote_heads feature","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-11-14T18:15:17Z","receivedAt":"2008-11-14T18:15:17Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Thu, 13 Nov 2008, Giuseppe Bilotta wrote:\n\n> With this feature enabled, remotes are retrieved (and displayed)\n> when getting (and displaying) the heads list.\n\nI think it would be good idea to add in commit message idea _why_\nsuch feature would be useful, for example\n\n  This is useful if you want to use git-instaweb to examine the state\n  of repository, influding remote-tracking branches, or a repository\n  is fork of other repository, and remote-tracking branches are used\n  to see what commits this fork has in addition to those from forked\n  (main) repository.\n\nOr something like that.\n\nIt would be also in my opinion a good idea to modify git-instaweb.sh\n(I guess better in separate commit) to make it make use of this new\nfeature... unless it does it already, doesn't it?\n\n> \n> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n> ---\n>  gitweb/gitweb.perl |   31 +++++++++++++++++++++++++++++--\n>  1 files changed, 29 insertions(+), 2 deletions(-)\n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 933e137..b6c4233 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -327,6 +327,18 @@ our %feature = (\n>  \t'ctags' => {\n>  \t\t'override' => 0,\n>  \t\t'default' => [0]},\n> +\n> +\t# Make gitweb show remotes too in the heads list\n\nI'm not native engish speaker, but shouldn't instead of \"remotes too\"\nbe \"also remotes\" or \"remotes also\"?\n\n> +\n> +\t# To enable system wide have in $GITWEB_CONFIG\n> +\t# $feature{'remote_heads'}{'default'} = [1];\n> +\t# To have project specific config enable override in $GITWEB_CONFIG\n> +\t# $feature{'remote_heads'}{'override'} = 1;\n> +\t# and in project config gitweb.remote_heads = 0|1;\n> +\t'remote_heads' => {\n> +\t\t'sub' => \\&feature_remote_heads,\n> +\t\t'override' => 0,\n> +\t\t'default' => [0]},\n>  );\n>  \n>  sub gitweb_check_feature {\n> @@ -392,6 +404,18 @@ sub feature_pickaxe {\n>  \treturn ($_[0]);\n>  }\n>  \n> +sub feature_remote_heads {\n> +\tmy ($val) = git_get_project_config('remote_heads', '--bool');\n> +\n> +\tif ($val eq 'true') {\n> +\t\treturn (1);\n> +\t} elsif ($val eq 'false') {\n> +\t\treturn (0);\n> +\t}\n> +\n> +\treturn ($_[0]);\n> +}\n\nHmmm... I think it is hight time to provide option to \ngit_get_project_config to _not_ use backward compatibility with \n'git config --bool', i.e. return Perl bool, and not 'true'/'false'\nstring.\n\nBut this is I think outside scope of this patch...\n\n> +\n>  # checking HEAD file with -e is fragile if the repository was\n>  # initialized long time ago (i.e. symlink HEAD) and was pack-ref'ed\n>  # and then pruned.\n> @@ -2642,10 +2666,12 @@ sub git_get_heads_list {\n>  \tmy $limit = shift;\n>  \tmy @headslist;\n>  \n> +\tmy ($remote_heads) = gitweb_check_feature('remote_heads');\n> +\n>  \topen my $fd, '-|', git_cmd(), 'for-each-ref',\n>  \t\t($limit ? '--count='.($limit+1) : ()), '--sort=-committerdate',\n>  \t\t'--format=%(objectname) %(refname) %(subject)%00%(committer)',\n> -\t\t'refs/heads'\n> +\t\t'refs/heads', ( $remote_heads ? 'refs/remotes' : '')\n>  \t\tor return;\n>  \twhile (my $line = <$fd>) {\n>  \t\tmy %ref_item;\n> @@ -2656,8 +2682,9 @@ sub git_get_heads_list {\n>  \t\tmy ($committer, $epoch, $tz) =\n>  \t\t\t($committerinfo =~ /^(.*) ([0-9]+) (.*)$/);\n>  \t\t$ref_item{'fullname'}  = $name;\n> -\t\t$name =~ s!^refs/heads/!!;\n> +\t\t$name =~ s!^refs/(head|remote)s/!!;\n>  \n> +\t\t$ref_item{'class'} = $1;\n\nNice catch.\n\n>  \t\t$ref_item{'name'}  = $name;\n>  \t\t$ref_item{'id'}    = $hash;\n>  \t\t$ref_item{'title'} = $title || '(no commit message)';\n> -- \n> 1.5.6.5\n> \n> \n\n-- \nJakub Narebski\nPoland\n"},{"id":"95811","messageId":"cb7bb73a0811141037o26532f34k6a3e0193cd06e79a@mail.gmail.com","threadId":"16322","inReplyTo":"200811141533.15427.jnareb@gmail.com","subject":"Re: [PATCH v2 00/11] gitweb: display remote heads","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-14T18:37:36Z","receivedAt":"2008-11-14T18:37:36Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Fri, Nov 14, 2008 at 3:33 PM, Jakub Narebski <jnareb@gmail.com> wrote:\n> On Thu, 13 Nov 2008, Giuseppe Bilotta wrote:\n>\n>> This is a patchset I presented about a year ago or so, but after a lively\n>> discussion it dropped into silence. I'm now presenting it again, with minor\n>> cleanups and adjustements.\n>\n> That is very nice of you to resend this series. If you could provide\n> link to earlier discussion of this series...\n\nThere was no actual discussion after I sent the series, although there\nwas some while I was preparing it. Plus, gmane is quite unresponsive\nfor me at the moment, but the whereabous of the past discussions are\nthese http://kerneltrap.org/mailarchive/git/2007/8/30/256411/thread\n\n>> Giuseppe Bilotta (11):\n>>   gitweb: introduce remote_heads feature\n>>   gitweb: git_get_heads_list accepts an optional list of refs.\n>>   gitweb: separate heads and remotes list in summary view\n>>   gitweb: optional custom name for refs in git_heads_body\n>>   gitweb: git_split_heads_body function.\n>>   gitweb: use CSS to style split head lists.\n>>   gitweb: add 'remotes' action\n>>   gitweb: display HEAD in heads list when detached\n>>   gitweb: git_is_head_detached() function\n>>   gitweb: add HEAD to list of shortlog refs if detached\n>>   gitweb: CSS style and refs mark for detached HEAD\n>\n> I'll try to review individual patches, but I haven't examined them\n> yet, so perhaps there is a reason why there are so many patches in\n> this series?\n\nAnd I actually squashed some! The original patchset was 14 patches.\nNow it's about 10, of which the first 6 as the actual remote heads\nstuff, and the last 4 are the detached HEAD stuff.\n\n> Note that on GMane NNTP (news) interface I can see only two last\n> patches. Could anyone not CC-ed confirm or deny if this is VGER\n> anti-SPAM filter at work, or some GMane archive hiccup?\n\nSeems to be a gmane problem, I can see it too.\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"95813","messageId":"200811141948.57785.jnareb@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-3-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH v2 02/11] gitweb: git_get_heads_list accepts an optional list of refs.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-11-14T18:48:57Z","receivedAt":"2008-11-14T18:48:57Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Dnia czwartek 13. listopada 2008 23:49, Giuseppe Bilotta napisał:\n\n> git_get_heads_list(limit, dir1, dir2, ...) can now be used to retrieve\n> refs/dir1, refs/dir2 etc. Defaults to ('heads') or ('heads', 'remotes')\n> depending on the remote_heads option.\n\nMinor nit: I think it would be better to use the same terminology in\ncommit message as in code, i.e. 'class1' instead of 'dir1', or perhaps\n'ref_class1' if it would be better.\n\nThis is only a suggestion, but perhaps this patch could be squashed\nwith a later one?\n\n> \n> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n> ---\n>  gitweb/gitweb.perl |   11 +++++++----\n>  1 files changed, 7 insertions(+), 4 deletions(-)\n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index b6c4233..d7c97a3 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -2663,15 +2663,18 @@ sub parse_from_to_diffinfo {\n>  ## parse to array of hashes functions\n>  \n>  sub git_get_heads_list {\n> -\tmy $limit = shift;\n> +\tmy ($limit, @class) = @_;\n> +\tunless (defined @class) {\n> +\t\tmy ($remote_heads) = gitweb_check_feature('remote_heads');\n> +\t\t@class = ('heads', $remote_heads ? 'remotes' : undef);\n> +\t}\n> +\tmy @refs = map { \"refs/$_\" } @class;\n\nNice.\n\n>  \tmy @headslist;\n>  \n> -\tmy ($remote_heads) = gitweb_check_feature('remote_heads');\n> -\n>  \topen my $fd, '-|', git_cmd(), 'for-each-ref',\n>  \t\t($limit ? '--count='.($limit+1) : ()), '--sort=-committerdate',\n>  \t\t'--format=%(objectname) %(refname) %(subject)%00%(committer)',\n> -\t\t'refs/heads', ( $remote_heads ? 'refs/remotes' : '')\n> +\t\t@refs\n>  \t\tor return;\n>  \twhile (my $line = <$fd>) {\n>  \t\tmy %ref_item;\n\nSo this is a bit of generalization of (part of) previous patch,\nisn't it?\n\n-- \nJakub Narebski\nPoland\n"},{"id":"95822","messageId":"200811142104.35019.jnareb@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-4-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH v2 03/11] gitweb: separate heads and remotes list in summary view","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-11-14T20:04:34Z","receivedAt":"2008-11-14T20:04:34Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Dnia czwartek 13. listopada 2008 23:49, Giuseppe Bilotta napisał:\n\nVery nice patch. Now that I have read it, I don't think it should be\nsquashed with previous patch (well, again that is only a suggestion).\nBarring one issue (see below) its conciseness shows that gitweb has\nquite good internal API.\n\n> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n> ---\n>  gitweb/gitweb.perl |   11 ++++++++++-\n>  1 files changed, 10 insertions(+), 1 deletions(-)\n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index d7c97a3..ab29aec 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -4449,6 +4449,7 @@ sub git_summary {\n>  \tmy %co = parse_commit(\"HEAD\");\n>  \tmy %cd = %co ? parse_date($co{'committer_epoch'}, $co{'committer_tz'}) : ();\n>  \tmy $head = $co{'id'};\n> +\tmy ($remote_heads) = gitweb_check_feature('remote_heads');\n>  \n>  \tmy $owner = git_get_project_owner($project);\n>  \n> @@ -4456,7 +4457,8 @@ sub git_summary {\n>  \t# These get_*_list functions return one more to allow us to see if\n>  \t# there are more ...\n>  \tmy @taglist  = git_get_tags_list(16);\n> -\tmy @headlist = git_get_heads_list(16);\n> +\tmy @headlist = git_get_heads_list(16, 'heads');\n> +\tmy @remotelist = $remote_heads ? git_get_heads_list(16, 'remotes') : ();\n\nNice.\n\n>  \tmy @forklist;\n>  \tmy ($check_forks) = gitweb_check_feature('forks');\n>  \n> @@ -4535,6 +4537,13 @@ sub git_summary {\n>  \t\t               $cgi->a({-href => href(action=>\"heads\")}, \"...\"));\n>  \t}\n>  \n> +\tif (@remotelist) {\n> +\t\tgit_print_header_div('remotes');\n> +\t\tgit_heads_body(\\@remotelist, $head, 0, 15,\n> +\t\t               $#remotelist <= 15 ? undef :\n> +\t\t               $cgi->a({-href => href(action=>\"heads\")}, \"...\"));\n> +\t}\n> +\n\nThe only problem is that link leads to list of _all_ heads (best case),\nor list to local branches (worst case, but I don't think gitweb does\nit), instead of only list of remotes refs (remote-tracking branches),\nas one would think.  Perhaps we could use 'h' (hash), or 'opt (extra\noptions) parameter for this action, or just add 'remotes' action? \n\n>  \tif (@forklist) {\n>  \t\tgit_print_header_div('forks');\n>  \t\tgit_project_list_body(\\@forklist, 'age', 0, 15,\n> -- \n> 1.5.6.5\n\nP.S. Not uptodate (git version 1.6.0.4)? Just kidding...\n\n-- \nJakub Narebski\nPoland\n"},{"id":"95828","messageId":"20081115061721.6117@nanako3.lavabit.com","threadId":"16322","inReplyTo":"7vk5b69p87.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v2 09/11] gitweb: git_is_head_detached() function","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2008-11-14T21:17:21Z","receivedAt":"2008-11-14T21:17:21Z","isPatch":true,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting Junio C Hamano <gitster@pobox.com>:\n\n> \"Giuseppe Bilotta\" <giuseppe.bilotta@gmail.com> writes:\n>\n>> I have been thinking about making this detached HEAD thing an\n>> additional option, but it _really_ seemed like overkill.\n>\n> I agree that it does not make much sense to make this feature an option.\n> Detaching the HEAD in the repository itself is an enough clue from the\n> user to the code that the user wants to trigger the feature.\n\nShouldn't the feature to show remote tracking branches also be unconditionally active, then?\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"95830","messageId":"cb7bb73a0811141344q4360351do346def5515ec157b@mail.gmail.com","threadId":"16322","inReplyTo":"200811141915.17680.jnareb@gmail.com","subject":"Re: [PATCH v2 01/11] gitweb: introduce remote_heads feature","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-14T21:44:02Z","receivedAt":"2008-11-14T21:44:02Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Fri, Nov 14, 2008 at 7:15 PM, Jakub Narebski <jnareb@gmail.com> wrote:\n> On Thu, 13 Nov 2008, Giuseppe Bilotta wrote:\n>\n>> With this feature enabled, remotes are retrieved (and displayed)\n>> when getting (and displaying) the heads list.\n>\n> I think it would be good idea to add in commit message idea _why_\n> such feature would be useful, for example\n>\n>  This is useful if you want to use git-instaweb to examine the state\n>  of repository, influding remote-tracking branches, or a repository\n>  is fork of other repository, and remote-tracking branches are used\n>  to see what commits this fork has in addition to those from forked\n>  (main) repository.\n>\n> Or something like that.\n\nAh yes, many commit messages in this patchset are way too terse. A\nside effect of this being something like the first patchset I ever\nprepared. I'll rework them to something more sensible.\n\n> It would be also in my opinion a good idea to modify git-instaweb.sh\n> (I guess better in separate commit) to make it make use of this new\n> feature... unless it does it already, doesn't it?\n\nIt doesn't, but it's something I have considered. I'll work on it (on\na separate patch)\n\n\n>> +     # Make gitweb show remotes too in the heads list\n>\n> I'm not native engish speaker, but shouldn't instead of \"remotes too\"\n> be \"also remotes\" or \"remotes also\"?\n\nNo idea, I guess we'll wait for a native english speaker opinion 8-D\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"95832","messageId":"cb7bb73a0811141352p6e46196cq9272b60bba89b951@mail.gmail.com","threadId":"16322","inReplyTo":"200811141948.57785.jnareb@gmail.com","subject":"Re: [PATCH v2 02/11] gitweb: git_get_heads_list accepts an optional list of refs.","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-14T21:52:45Z","receivedAt":"2008-11-14T21:52:45Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Fri, Nov 14, 2008 at 7:48 PM, Jakub Narebski <jnareb@gmail.com> wrote:\n> Dnia czwartek 13. listopada 2008 23:49, Giuseppe Bilotta napisał:\n>\n>> git_get_heads_list(limit, dir1, dir2, ...) can now be used to retrieve\n>> refs/dir1, refs/dir2 etc. Defaults to ('heads') or ('heads', 'remotes')\n>> depending on the remote_heads option.\n>\n> Minor nit: I think it would be better to use the same terminology in\n> commit message as in code, i.e. 'class1' instead of 'dir1', or perhaps\n> 'ref_class1' if it would be better.\n\nUhm, ref/ref_class1 reads horrible, but sticking with a uniform\nterminology is a good point. I adjusted the commit message\nconsequently.\n\n> This is only a suggestion, but perhaps this patch could be squashed\n> with a later one?\n\nOr with the previous one, since as you remark it's a generalization of\nthe previous.\n\n>>       my @headslist;\n>>\n>> -     my ($remote_heads) = gitweb_check_feature('remote_heads');\n>> -\n>>       open my $fd, '-|', git_cmd(), 'for-each-ref',\n>>               ($limit ? '--count='.($limit+1) : ()), '--sort=-committerdate',\n>>               '--format=%(objectname) %(refname) %(subject)%00%(committer)',\n>> -             'refs/heads', ( $remote_heads ? 'refs/remotes' : '')\n>> +             @refs\n>>               or return;\n>>       while (my $line = <$fd>) {\n>>               my %ref_item;\n>\n> So this is a bit of generalization of (part of) previous patch,\n> isn't it?\n\nPrecisely. I must say I had problems finding the proper splitting\npoint for some of these patches, because they had a very organic\nevolution, but at the same time sqashing them together would give too\nlarge changesets at once. You'll find that this is not the only patch\nthat makes the most sense only after seeing what comes later.\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"95833","messageId":"cb7bb73a0811141401r748b5a4em4e5711935dd16a1@mail.gmail.com","threadId":"16322","inReplyTo":"200811142104.35019.jnareb@gmail.com","subject":"Re: [PATCH v2 03/11] gitweb: separate heads and remotes list in summary view","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-14T22:01:28Z","receivedAt":"2008-11-14T22:01:28Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"2008/11/14 Jakub Narebski <jnareb@gmail.com>:\n> Dnia czwartek 13. listopada 2008 23:49, Giuseppe Bilotta napisał:\n>\n> Very nice patch. Now that I have read it, I don't think it should be\n> squashed with previous patch (well, again that is only a suggestion).\n\nSee reply in previous patch. Sometimes it's hard to tell what's the\nbest patch-splitting strategy ...\n\n> Barring one issue (see below) its conciseness shows that gitweb has\n> quite good internal API.\n\nMost definitely. I find that working on gitweb is almost pleasurable ;-)\n[I mean, it's still Perl, which is not Tcl but not Ruby either 8-P]\n\n>>       my @forklist;\n>>       my ($check_forks) = gitweb_check_feature('forks');\n>>\n>> @@ -4535,6 +4537,13 @@ sub git_summary {\n>>                              $cgi->a({-href => href(action=>\"heads\")}, \"...\"));\n>>       }\n>>\n>> +     if (@remotelist) {\n>> +             git_print_header_div('remotes');\n>> +             git_heads_body(\\@remotelist, $head, 0, 15,\n>> +                            $#remotelist <= 15 ? undef :\n>> +                            $cgi->a({-href => href(action=>\"heads\")}, \"...\"));\n>> +     }\n>> +\n>\n> The only problem is that link leads to list of _all_ heads (best case),\n> or list to local branches (worst case, but I don't think gitweb does\n> it), instead of only list of remotes refs (remote-tracking branches),\n> as one would think.  Perhaps we could use 'h' (hash), or 'opt (extra\n> options) parameter for this action, or just add 'remotes' action?\n\nAdding a 'remotes' section (and corresponding action, too) is what is\ndone by subsequent patches. It's quite obvious, I think, that the\npatch sequence follows _very_ closely the order in which I\nimplemented/tested features. It might make more sense to move some of\nthem earlier, but then such earlier patches would only make sense\nbecause of the ones that follow ... this is why I decided to keep the\nsequence as is.\n\n>> 1.5.6.5\n>\n> P.S. Not uptodate (git version 1.6.0.4)? Just kidding...\n\nYeah, I know, given that I work with 'next' gitweb, I could as well\njust upgrade the system git to the same version 8-P\n\nInstead, I'm just relying on stock Debian stuff, which obviously,\nbeing in freeze now, is not updating unstable either 8-P\n\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"95846","messageId":"200811150032.14558.jnareb@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-5-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH v2 04/11] gitweb: optional custom name for refs in git_heads_body","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-11-14T23:32:14Z","receivedAt":"2008-11-14T23:32:14Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Thu, 13 Nov 2008, Giuseppe Bilotta wrote:\n\n> We make a clear separation between the hash reference and the displayed\n> name for refs displayed by git_heads_body. This can be used e.g. to\n> group them and display only the distinct part of the name.\n\nIt is not clear for me from this commit message what this patch\nis meant to do. Already git_heads_body (and also git_tags_body)\nuses $ref{'name'} for display, and $ref{'fullname'} for linking\n(to avoid possibility of tag/branch name conflict).\n\n> \n> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n> ---\n>  gitweb/gitweb.perl |   12 +++++++-----\n>  1 files changed, 7 insertions(+), 5 deletions(-)\n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index ab29aec..a736f2a 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -4288,16 +4288,18 @@ sub git_heads_body {\n>  \t\t} else {\n>  \t\t\tprint \"<tr class=\\\"light\\\">\\n\";\n>  \t\t}\n> +\t\tmy $hname = $ref{'hname'} || $ref{'fullname'} || $ref{'name'};\n\nI don't remember setting $ref{'hname'} anywhere; if there is a patch\nthat sets this, it should really be squashed together with this commit.\nOtherwise the commit is not standalone, as it should be.\n\n> +\t\tmy $name = $ref{'name'};\n\nI understand that this is simply \"shortcut\" name, to avoid using\n$ref{'name'} everywhere else, and instead using $name?  This is a bit\nindependent, I mean in the sense that it makes sense to squash those\npatches together in a kind of \"by the way\" way, i.e. simplify the code\nif we are making changes in this area.\n\n>  \t\t$alternate ^= 1;\n>  \t\tprint \"<td><i>$ref{'age'}</i></td>\\n\" .\n>  \t\t      ($curr ? \"<td class=\\\"current_head\\\">\" : \"<td>\") .\n> -\t\t      $cgi->a({-href => href(action=>\"shortlog\", hash=>$ref{'fullname'}),\n> -\t\t               -class => \"list name\"},esc_html($ref{'name'})) .\n> +\t\t      $cgi->a({-href => href(action=>\"shortlog\", hash=>$hname),\n> +\t\t               -class => \"list name\"},esc_html($name)) .\n>  \t\t      \"</td>\\n\" .\n>  \t\t      \"<td class=\\\"link\\\">\" .\n> -\t\t      $cgi->a({-href => href(action=>\"shortlog\", hash=>$ref{'fullname'})}, \"shortlog\") . \" | \" .\n> -\t\t      $cgi->a({-href => href(action=>\"log\", hash=>$ref{'fullname'})}, \"log\") . \" | \" .\n> -\t\t      $cgi->a({-href => href(action=>\"tree\", hash=>$ref{'fullname'}, hash_base=>$ref{'name'})}, \"tree\") .\n> +\t\t      $cgi->a({-href => href(action=>\"shortlog\", hash=>$hname)}, \"shortlog\") . \" | \" .\n> +\t\t      $cgi->a({-href => href(action=>\"log\", hash=>$hname)}, \"log\") . \" | \" .\n> +\t\t      $cgi->a({-href => href(action=>\"tree\", hash=>$hname, hash_base=>$hname)}, \"tree\") .\n>  \t\t      \"</td>\\n\" .\n>  \t\t      \"</tr>\";\n>  \t}\n\nSo, in short I think this patch needs work, at least better commit\nmessage (perhaps I don't understand something...)\n\n-- \nJakub Narebski\nPoland\n"},{"id":"95848","messageId":"200811150059.14515.jnareb@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-6-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH v2 05/11] gitweb: git_split_heads_body function.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-11-14T23:59:14Z","receivedAt":"2008-11-14T23:59:14Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Thu, 13 Nov 2008, Giuseppe Bilotta wrote:\n\n> The purpose of this function is to split a headlist into groups\n> determined by the leading part of the refname, and call git_heads_body()\n> on each group.\n\nWhat is the reason of this patch? Is it to split remote-tracking\nbranches ('remotes' references) into remotes, and group them by\nthe remote repository name?\n\nIf it is true, then first: you should have wrote the _reason_ behind\nthis patch and not only what it does in this commit message. And use\nbetter summary (commit title / subject of this patch).\n\nSecond, this patch wouldn't do what you want from it if there are\nremotes with '/' in name.  I for example use \"gsoc2008/gitweb-caching\"\nfor Lea Wiemann repository with her GSoC 2008 work on adding caching\nto gitweb.  Because there are many ways to specify remotes due to\nbackwards compatibility (and simplicity, as some for example prefer\nold 'branches/' way to specify remotes), namely config, files under\n'.git/remotes', and (from Cogito) files in '.git/branches', you would\nhave to either reimplement/reuse parts of git-remote (there is old Perl\nimplementation in contrib/examples), or use \"git remote\" or \n\"git remote -v\" command output[1].\n\n\nSo from me there is slight NAK on this patch, in this form.\n\n> \n> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n> ---\n>  gitweb/gitweb.perl |   33 ++++++++++++++++++++++++++++++++-\n>  1 files changed, 32 insertions(+), 1 deletions(-)\n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index a736f2a..836b6ba 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -4271,6 +4271,37 @@ sub git_tags_body {\n>  \tprint \"</table>\\n\";\n>  }\n>  \n> +sub git_split_heads_body {\n> +\tmy ($headlist, $head, $from, $to, $extra) = @_;\n\nIt should probably be said somewhere that git_split_heads_body has to\nhave the same signature as git_heads_body.\n\n> +\tmy %headlists;\n> +\tmy $leader; my $list; my @list;\n\nStyle - I would use:\n\n+\tmy ($leader, $list, @list);\n\nalthough I wouldn't use $list and @list together...\n\n> +\n> +\t# Split @$headlist into a hash of lists\n> +\tmap {\n> +\t\tmy %ref = %$_;\n> +\t\t$ref{'hname'} = $ref{'name'};\n> +\t\tif ($ref{'name'} =~ /\\//) {\n> +\t\t\t$ref{'name'} =~ s!^([^/]+)/!!;\n\nAs I said, this would fail on for example \"gsoc2008/gitweb-caching\"\nremote...\n\n> +\t\t\t$leader = $1;\n> +\t\t} else {\n> +\t\t\t$leader = \"\\000\";\n\nCan't you use undef or \"\" for $leader? $headlists{undef} works...\n\n> +\t\t}\n> +\t\tif (defined $headlists{$leader}) {\n> +\t\t\t@list = @{$headlists{$leader}}\n> +\t\t} else {\n> +\t\t\t@list = ()\n> +\t\t}\n> +\t\tpush @list, \\%ref;\n> +\t\t$headlists{$leader} = [@list];\n\nWe have similar code in href(), but we use there:\n\n  if (defined $ref{key}) {\n  \tpush @{$ref{$key}}, $elem;\n  } else {\n  \t$ref{$key} = [ $elem ];\n  }\n\nIsn't it simpler and easier to understand?\n\n\n> +\t} @$headlist;\n\nWhy such ugly and ungainy 'map' invocation, instead of IMHO simpler\nand better here foreach loop?\n\n> +\n> +\tforeach $leader (sort(keys %headlists)) {\n> +\t\tprint \"<b>$leader</b><br/>\\n\" unless $leader eq \"\\000\";\n> +\t\t$list = $headlists{$leader};\n> +\t\tgit_heads_body($list, $head, $from, $to, $extra);\n> +\t}\n> +}\n\nWouldn't be it simpler to loop over @$headlist, and if prefix (or to be\nmore exact repository shorthand aka 'remote') changes then run \ngit_heads_body, adjusting $from / $to accordingly, based on current and\nremembered index? I think we can assume that list is sorted by refname,\ncan't we? If not then perhaps the way by building hash is good idea\nafter all...\n\n> +\n>  sub git_heads_body {\n>  \t# uses global variable $project\n>  \tmy ($headlist, $head, $from, $to, $extra) = @_;\n> @@ -4541,7 +4572,7 @@ sub git_summary {\n>  \n>  \tif (@remotelist) {\n>  \t\tgit_print_header_div('remotes');\n> -\t\tgit_heads_body(\\@remotelist, $head, 0, 15,\n> +\t\tgit_split_heads_body(\\@remotelist, $head, 0, 15,\n>  \t\t               $#remotelist <= 15 ? undef :\n>  \t\t               $cgi->a({-href => href(action=>\"heads\")}, \"...\"));\n>  \t}\n\nNice.\n\n\nFootnotes:\n==========\n[1] It is strange that there is no explicit \"git remote list\"\n-- \nJakub Narebski\nPoland\n"},{"id":"95851","messageId":"200811150120.51805.jnareb@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-7-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH v2 06/11] gitweb: use CSS to style split head lists.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-11-15T00:20:50Z","receivedAt":"2008-11-15T00:20:50Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Thu, 13 Nov 2008, Giuseppe Bilotta wrote:\n\n> Introduce a new div class 'subsection' in the CSS and use it to style\n> split head lists.\n\nI think this patch should be squashed with the previous one.\n \n> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n> ---\n>  gitweb/gitweb.css  |   10 ++++++++++\n>  gitweb/gitweb.perl |    4 +++-\n>  2 files changed, 13 insertions(+), 1 deletions(-)\n> \n> diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css\n> index a01eac8..751749f 100644\n> --- a/gitweb/gitweb.css\n> +++ b/gitweb/gitweb.css\n> @@ -8,6 +8,16 @@ body {\n>  \tcolor: #000000;\n>  }\n>  \n> +div.subsection {\n> +\tborder: solid #d9d8d1;\n> +\tborder-width: 1px;\n> +\tmargin: 10px;\n> +}\n> +\n> +.subsection .title {\n> +\tfont-size: smaller;\n> +}\n\nHmmm... do we use \"subsection title\" class anywhere? If you did\nintroduce it in earlier patch, this is one more reason to squash\nthem (after significant reworking)... ahh, this is link or span\nor div with class .title insider div.subsection, sorry.\n\n> +\n>  a {\n>  \tcolor: #0000cc;\n>  }\n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 836b6ba..03e0b21 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -4296,9 +4296,11 @@ sub git_split_heads_body {\n>  \t} @$headlist;\n>  \n>  \tforeach $leader (sort(keys %headlists)) {\n> -\t\tprint \"<b>$leader</b><br/>\\n\" unless $leader eq \"\\000\";\n> +\t\tprint \"<div class=\\\"subsection\\\">\\n\";\n> +\t\tgit_print_header_div(undef, $leader) unless $leader eq \"\\000\";\n\nAgain, cannot this ugly guardian value be replaced by for example empty\nstring '', or undef?\n\n>  \t\t$list = $headlists{$leader};\n>  \t\tgit_heads_body($list, $head, $from, $to, $extra);\n> +\t\tprint \"</div>\\n\";\n\nJust in case, for easier editing and easier browsing through *occur*\nbuffer, I'd use here\n\n+\t\tprint \"</div>\\n\"; # class=\"subsection\"\n\n\n>  \t}\n>  }\n>  \n\n-- \nJakub Narebski\nPoland\n"},{"id":"95866","messageId":"cb7bb73a0811150204v15463275sf63098b819c6d259@mail.gmail.com","threadId":"16322","inReplyTo":"200811150059.14515.jnareb@gmail.com","subject":"Re: [PATCH v2 05/11] gitweb: git_split_heads_body function.","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-15T10:04:06Z","receivedAt":"2008-11-15T10:04:06Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Sat, Nov 15, 2008 at 12:59 AM, Jakub Narebski <jnareb@gmail.com> wrote:\n> On Thu, 13 Nov 2008, Giuseppe Bilotta wrote:\n>\n>> The purpose of this function is to split a headlist into groups\n>> determined by the leading part of the refname, and call git_heads_body()\n>> on each group.\n>\n> What is the reason of this patch? Is it to split remote-tracking\n> branches ('remotes' references) into remotes, and group them by\n> the remote repository name?\n>\n> If it is true, then first: you should have wrote the _reason_ behind\n> this patch and not only what it does in this commit message. And use\n> better summary (commit title / subject of this patch).\n>\n> Second, this patch wouldn't do what you want from it if there are\n> remotes with '/' in name.  I for example use \"gsoc2008/gitweb-caching\"\n> for Lea Wiemann repository with her GSoC 2008 work on adding caching\n> to gitweb.  Because there are many ways to specify remotes due to\n> backwards compatibility (and simplicity, as some for example prefer\n> old 'branches/' way to specify remotes), namely config, files under\n> '.git/remotes', and (from Cogito) files in '.git/branches', you would\n> have to either reimplement/reuse parts of git-remote (there is old Perl\n> implementation in contrib/examples), or use \"git remote\" or\n> \"git remote -v\" command output[1].\n\nThe initially intended purpose for this patch was to group remote\nheads by remotes, but an interesting side-effect of doing it this way\nwas that it allowed to group _local_ heads too, by using the\nstuff/morestuff syntax. For example, I could group gitweb/pathinfo and\ngitweb/allheads together (although I disabled this grouping for local\nheads in the patchset).\n\nHowever, as you remark, the current patch fails to achieve even its\nintended purpose, so it looks like going the 'git remote' way would be\nthe right way to find at least the grouping keys: this has the benefit\nof allowing us to retrieve the remote URL as well by using 'git remote\n-v', although it has the underside of require one additional git call.\n\nIt would also probably be a good idea to separate the actual head\ngrouping from the display of the grouped head lists. I wonder if Perl\nhas a 'tree' data structure that could be used to store the grouped\nhead lists ...\n\nAh yes, the code in this patch I was never actually really satisfied\nwith, hopefully I can rewrite it more sensibly with the adittional\nexperience I've accumulated this year.\n\n>> +\n>> +     # Split @$headlist into a hash of lists\n>> +     map {\n>> +             my %ref = %$_;\n>> +             $ref{'hname'} = $ref{'name'};\n>> +             if ($ref{'name'} =~ /\\//) {\n>> +                     $ref{'name'} =~ s!^([^/]+)/!!;\n>\n> As I said, this would fail on for example \"gsoc2008/gitweb-caching\"\n> remote...\n\nWould you say that in this case we want 'gsoc2008/gitweb-caching' as\nthe group head, or would you rather have nested groups [gsoc2008\n[gitweb-caching [branches in gsoc2008/gitweb-caching] [etc]] ? I must\nsay that I think the latter would be quite interesting, but I _am_ a\nlittle afraid we could turn up with way too much nested groups ...\n\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"95867","messageId":"cb7bb73a0811150211g1a48f0d1m184bbe193dea6542@mail.gmail.com","threadId":"16322","inReplyTo":"200811150032.14558.jnareb@gmail.com","subject":"Re: [PATCH v2 04/11] gitweb: optional custom name for refs in git_heads_body","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-15T10:11:16Z","receivedAt":"2008-11-15T10:11:16Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Sat, Nov 15, 2008 at 12:32 AM, Jakub Narebski <jnareb@gmail.com> wrote:\n> On Thu, 13 Nov 2008, Giuseppe Bilotta wrote:\n>\n>> We make a clear separation between the hash reference and the displayed\n>> name for refs displayed by git_heads_body. This can be used e.g. to\n>> group them and display only the distinct part of the name.\n>\n> It is not clear for me from this commit message what this patch\n> is meant to do. Already git_heads_body (and also git_tags_body)\n> uses $ref{'name'} for display, and $ref{'fullname'} for linking\n> (to avoid possibility of tag/branch name conflict).\n\n>> +             my $hname = $ref{'hname'} || $ref{'fullname'} || $ref{'name'};\n>\n> I don't remember setting $ref{'hname'} anywhere; if there is a patch\n> that sets this, it should really be squashed together with this commit.\n> Otherwise the commit is not standalone, as it should be.\n\nThe patch that sets hname is the next patch (the one that introduces\ngit_split_heads_body. It's quite obvious that this whole 'split head\nlists' part needs some rethinking.\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"95875","messageId":"7vprkx5gqb.fsf@gitster.siamese.dyndns.org","threadId":"16322","inReplyTo":"200811150059.14515.jnareb@gmail.com","subject":"Re: [PATCH v2 05/11] gitweb: git_split_heads_body function.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-11-15T12:14:04Z","receivedAt":"2008-11-15T12:14:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> Second, this patch wouldn't do what you want from it if there are\n> remotes with '/' in name.  I for example use \"gsoc2008/gitweb-caching\"\n> for Lea Wiemann repository with her GSoC 2008 work on adding caching\n> to gitweb.\n\nI think your point is if you also use gsoc2008/gitstats from another\nremote repository, these two sets of remote tracking branches will be\nshown grouped together.  But is it a bad thing?  After all, you chose to\nuse hierarchical names for them, _and_ you chose to use the same toplevel\nhierarchy name for them.  Doesn't that mean you _wanted_ to have them both\nappear in the same GSoC 2008 group?\n"},{"id":"95876","messageId":"200811151316.32024.jnareb@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-8-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH v2 07/11] gitweb: add 'remotes' action","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-11-15T12:16:30Z","receivedAt":"2008-11-15T12:16:30Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Thu, 13 Nov 2008, Giuseppe \"Oblomov\" Bilotta wrote:\n\n> This action is similar to the 'heads' action, but it displays\n> remote heads, grouped by remote repository.\n\nI think I would prefer would go together with the change that split\nthe 'heads' ('branches') part of summary view into 'heads' and\n'remotes', so that both section title header, and '...' continuation\nif present, lead to proper view.\n\nSo either\n\n  [heads]  # or [branches]\n  master\n  to-submit\n  origin/master\n  origin/next\n  ...\n\nwhere both '[heads]' and (possibly) '...' link to 'heads' view showing\n_both_ local branches (refs/heads/*) and remote-tracking branches\n(refs/remotes/*), like in first patch of series (perhaps with some\nsubdivision).\n\nOr\n\n  [heads]\n  master\n  to-submit\n  ...\n  [remotes]\n  origin/master\n  origin/next\n  ...\n\nwhere '[heads]' link to 'heads' view which shows only local branches\n(refs/heads/*), and '[remotes]' link to 'remotes' view which shows only\nremote-tracking branches.\n \n> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n> ---\n>  gitweb/gitweb.perl |   16 +++++++++++++++-\n>  1 files changed, 15 insertions(+), 1 deletions(-)\n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 03e0b21..09728cb 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -507,6 +507,7 @@ our %actions = (\n>  \t\"commit\" => \\&git_commit,\n>  \t\"forks\" => \\&git_forks,\n>  \t\"heads\" => \\&git_heads,\n> +\t\"remotes\" => \\&git_remotes,\n>  \t\"history\" => \\&git_history,\n>  \t\"log\" => \\&git_log,\n>  \t\"rss\" => \\&git_rss,\n> @@ -4755,13 +4756,26 @@ sub git_heads {\n>  \tgit_print_page_nav('','', $head,undef,$head);\n>  \tgit_print_header_div('summary', $project);\n>  \n> -\tmy @headslist = git_get_heads_list();\n> +\tmy @headslist = git_get_heads_list(undef, 'heads');\n\nHmmm... I wonder if it would be possible to use some DWIM-mery on\nthe side of git_get_heads_list (for example checking if first argument\nis a number, and assuming that nobody would be insane enough to use\nrefs/15 for namespace), and just use git_get_heads_list('heads') here.\n\nBut I guess that this form is good enough...\n\n>  \tif (@headslist) {\n>  \t\tgit_heads_body(\\@headslist, $head);\n>  \t}\n>  \tgit_footer_html();\n>  }\n>  \n> +sub git_remotes {\n> +\tmy $head = git_get_head_hash($project);\n> +\tgit_header_html();\n> +\tgit_print_page_nav('','', $head,undef,$head);\n> +\tgit_print_header_div('summary', $project . ' remotes');\n> +\n> +\tmy @headslist = git_get_heads_list(undef, 'remotes');\n> +\tif (@headslist) {\n> +\t\tgit_split_heads_body(\\@headslist, $head);\n> +\t}\n> +\tgit_footer_html();\n> +}\n\nNice. I see the difference from git_heads is using $project . ' remotes'\nin place of $project in git_print_header_div() (why?), and using \n'remotes' in call to git_get_heads_list().\n\n> +\n>  sub git_blob_plain {\n>  \tmy $type = shift;\n>  \tmy $expires;\n> -- \n> 1.5.6.5\n> \n> \n\n-- \nJakub Narebski\nPoland\n"},{"id":"95877","messageId":"cb7bb73a0811150425j2475db8dsdee57c1cc5e208ab@mail.gmail.com","threadId":"16322","inReplyTo":"7vprkx5gqb.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v2 05/11] gitweb: git_split_heads_body function.","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-15T12:25:59Z","receivedAt":"2008-11-15T12:25:59Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Sat, Nov 15, 2008 at 1:14 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jakub Narebski <jnareb@gmail.com> writes:\n>\n>> Second, this patch wouldn't do what you want from it if there are\n>> remotes with '/' in name.  I for example use \"gsoc2008/gitweb-caching\"\n>> for Lea Wiemann repository with her GSoC 2008 work on adding caching\n>> to gitweb.\n>\n> I think your point is if you also use gsoc2008/gitstats from another\n> remote repository, these two sets of remote tracking branches will be\n> shown grouped together.  But is it a bad thing?  After all, you chose to\n> use hierarchical names for them, _and_ you chose to use the same toplevel\n> hierarchy name for them.  Doesn't that mean you _wanted_ to have them both\n> appear in the same GSoC 2008 group?\n\nThe problem is that we have gsoc2008/gitweb-caching/branch1\ngsoc2008/gitweb-caching/branch2 gsoc2008/gitstats/branch3\ngsoc2008/gitstats/branch3, and my current code would show\ngitweb-caching/branch1, gitweb-caching/branch2 etc under gsoc2008.\n\nHaving branch1 and branch2 under gsoc2008/gitweb-caching, and branch3\nand branch4 under gsoc2008/gitstats would be more logical,\nremote-wise, but it would of course lose the coupling between all the\ngsoc2008 remotes.\n\nIf deep nesting is not a problem, I can code something to have\ngitweb-caching and gistats under gsoc2008, and the respective branches\nwithin.\n\n\n\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"95878","messageId":"cb7bb73a0811150432s2f3ae4bfkc0fc29d92accc635@mail.gmail.com","threadId":"16322","inReplyTo":"200811151316.32024.jnareb@gmail.com","subject":"Re: [PATCH v2 07/11] gitweb: add 'remotes' action","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-15T12:32:54Z","receivedAt":"2008-11-15T12:32:54Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Sat, Nov 15, 2008 at 1:16 PM, Jakub Narebski <jnareb@gmail.com> wrote:\n> On Thu, 13 Nov 2008, Giuseppe \"Oblomov\" Bilotta wrote:\n>\n>> This action is similar to the 'heads' action, but it displays\n>> remote heads, grouped by remote repository.\n>\n> I think I would prefer would go together with the change that split\n> the 'heads' ('branches') part of summary view into 'heads' and\n> 'remotes', so that both section title header, and '...' continuation\n> if present, lead to proper view.\n>\n> So either\n>\n>  [heads]  # or [branches]\n>  master\n>  to-submit\n>  origin/master\n>  origin/next\n>  ...\n>\n> where both '[heads]' and (possibly) '...' link to 'heads' view showing\n> _both_ local branches (refs/heads/*) and remote-tracking branches\n> (refs/remotes/*), like in first patch of series (perhaps with some\n> subdivision).\n>\n> Or\n>\n>  [heads]\n>  master\n>  to-submit\n>  ...\n>  [remotes]\n>  origin/master\n>  origin/next\n>  ...\n>\n> where '[heads]' link to 'heads' view which shows only local branches\n> (refs/heads/*), and '[remotes]' link to 'remotes' view which shows only\n> remote-tracking branches.\n\nThat's funny, I just squashed this patch with the summary list split\nview patch 8-) I'm going for the second option, to have [heads] link\nto heads which only lists local heads, and [remotes] linking to\nremotes that lists the remotes. We may or may not want to rather have\n[branches] instead of [heads], and keep the heads action to mean *all*\nheads, local and remote, but I'm not sure about it.\n\n>> -     my @headslist = git_get_heads_list();\n>> +     my @headslist = git_get_heads_list(undef, 'heads');\n>\n> Hmmm... I wonder if it would be possible to use some DWIM-mery on\n> the side of git_get_heads_list (for example checking if first argument\n> is a number, and assuming that nobody would be insane enough to use\n> refs/15 for namespace), and just use git_get_heads_list('heads') here.\n>\n> But I guess that this form is good enough...\n\nI've been wondering about this myself. Another possibility would be to\nuse named options instead of positional parameters, but then again it\nall looks like overkill, at least for the time being.\n\n>>       if (@headslist) {\n>>               git_heads_body(\\@headslist, $head);\n>>       }\n>>       git_footer_html();\n>>  }\n>>\n>> +sub git_remotes {\n>> +     my $head = git_get_head_hash($project);\n>> +     git_header_html();\n>> +     git_print_page_nav('','', $head,undef,$head);\n>> +     git_print_header_div('summary', $project . ' remotes');\n>> +\n>> +     my @headslist = git_get_heads_list(undef, 'remotes');\n>> +     if (@headslist) {\n>> +             git_split_heads_body(\\@headslist, $head);\n>> +     }\n>> +     git_footer_html();\n>> +}\n>\n> Nice. I see the difference from git_heads is using $project . ' remotes'\n> in place of $project in git_print_header_div() (why?),\n\nFWIW, I decided to scratch that additional ' remotes' string when\nsquashing this patch.\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"95906","messageId":"200811152331.17294.jnareb@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-9-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH v2 08/11] gitweb: display HEAD in heads list when detached","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-11-15T22:31:15Z","receivedAt":"2008-11-15T22:31:15Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Thu, 13 Nov 2008, Giuseppe Bilotta wrote:\n\nFirst, I think that _at least_ the first two patches dealing with\ndetached should be squashed.\n\nSecond, not this way!\n\n\nBut I think that support for detached HEAD (I am not sure if it should\nhave to be explicitly turned on using some %feature, or reusing some\nexisting feature like 'remote_heads') is a very good idea. Especially\nfor git-instaweb.\n\n> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n> ---\n>  gitweb/gitweb.perl |   21 +++++++++++++++++++++\n>  1 files changed, 21 insertions(+), 0 deletions(-)\n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 09728cb..a168f6f 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -2672,6 +2672,27 @@ sub git_get_heads_list {\n>  \tmy @refs = map { \"refs/$_\" } @class;\n>  \tmy @headslist;\n>  \n> +\tif (grep { $_ eq 'heads' } @class) {\n\nFirst, IMHO layering violation. Resolving detached HEAD should not be\nin my opinion left to git_get_heads_list, which is wrapped around \ngit-for-each-ref, which for some reason (contrary for example to\n\"git ls-remote .\" or \"git show-ref -h\") doesn't show HEAD even if it\nis detached. Probably misfeature / a bug in git-for-each-ref. I guess\nthat we should resolve detached HEAD in caller.\n\nBut I am not sure about this decision. Maybe instead of showing\ndetached HEAD (if it is detached) for 'heads', we should show it if\nthere is 'HEAD' in @class (well, @refs would have to be corrected,\ntoo)?\n\n> +\t\tmy @x = (git_cmd(), 'branch');\n> +\t\tmy @ret = split(\"\\n\", qx(@x));\n\n                                      ^^^^^^^- bit strange\n\nEspecially compared to almost everywhere else using open ... \"-|\"\n\n> +\t\tif (grep { /^\\* \\(no branch\\)$/ } @ret) { ;\n\n                                                          ^\n                            WTF? -------------------------|\n\nSecond, if we go the route of manually resolving detached HEAD, \ninstead of adding [-h|--head] (from git-show-ref) option equivalent\nto git-for-each-ref, which would work only for detached HEAD (fixing\nkind of a bug), this is *not* the way to do it.\n\nA. It should be done using encapsulation, adding is_HEAD_detached() or\ngit_is_head_detached() subroutine (squashing the next patch), or\nsimply using !defined($current_branch), where $current_branch would\nbe set using git_get_symbolic_ref('HEAD') or something.\n\nB. Using porcelain, especially end-user porcelain such as git-branch,\nwhich can change its output format (because they are porcelain). Use\nequivalent plumbing, be if git-symbolic-ref (\"git symbolic-ref -q HEAD\"\nto be more exact) to get current branch name[1], or just simply do\nthat in Perl: check if it is symlink, or if it starts with \"ref: \"\nif it is regular file (IIRC HEAD, even detached HEAD, cannot get\npacked into .git/packed-refs and deleted... at least I think so).\n\n[1] This means that we have better way of detecting (and showing)\nwhich branch is current one than comparing sha1 with resolved HEAD.\n($head_hash).\n\n> +\t\t\tmy %ref_item;\n> +\t\t\t@x = (git_cmd(), 'log', '-1', '--pretty=format:%H%n%ct%n%s');\n> +\t\t\tmy ($hash, $epoch, $title) = split(\"\\n\", qx(@x), 3);\n\nErrr... if we don't fix git-for-each-ref, and go that route, why not\nsimply use parse_commit subroutine, and extract relevant info from\nthere, instead of handcrafting git-log (why not git-show?) call?\n\nYou get more info than needed, but I think the cost of getting it is\nalmost the same, and you can reuse existing code.\n\nAnd if we go --pretty=format:<...> or --pretty=tformat:<...> route for\ngit-log, git-rev-list or git-show, wouldn't it be possible to generate\nthe same output format as git-for-each-ref below?\n\n> +\n> +\t\t\t$ref_item{'class'} = 'head';\n> +\t\t\t$ref_item{'name'} = 'HEAD';\n> +\t\t\t$ref_item{'id'} = $hash;\n> +\t\t\t$ref_item{'title'} = $title || '(no commit message)';\n> +\t\t\tif ($ref_item{'epoch'} = $epoch) {\n> +\t\t\t\t$ref_item{'age'} = age_string(time - $ref_item{'epoch'});\n\nHmmm...\n\n> +\t\t\t} else {\n> +\t\t\t\t$ref_item{'age'} = \"unknown\";\n> +\t\t\t}\n> +\t\t\tpush @headslist, \\%ref_item;\n> +\t\t}\n> +\t}\n> +\n>  \topen my $fd, '-|', git_cmd(), 'for-each-ref',\n>  \t\t($limit ? '--count='.($limit+1) : ()), '--sort=-committerdate',\n>  \t\t'--format=%(objectname) %(refname) %(subject)%00%(committer)',\n> -- \n> 1.5.6.5\n> \n> \n\n-- \nJakub Narebski\nPoland\n"},{"id":"95909","messageId":"200811160043.46017.jnareb@gmail.com","threadId":"16322","inReplyTo":"1226616555-24503-10-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH v2 09/11] gitweb: git_is_head_detached() function","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-11-15T23:43:45Z","receivedAt":"2008-11-15T23:43:45Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Thu, 13 Nov 2008, Giuseppe Bilotta wrote:\n\n> The function checks if the HEAD for the current project is detached by\n> checking if 'git branch' returns \"* (no branch)\"\n> \n> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n\nIn my opinion this patch should really be squashed together with\nprevious one. They belong together.\n\n> ---\n>  gitweb/gitweb.perl |   13 +++++++++----\n>  1 files changed, 9 insertions(+), 4 deletions(-)\n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index a168f6f..ceb0271 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -1844,6 +1844,13 @@ sub git_get_head_hash {\n>  \treturn $retval;\n>  }\n>  \n> +# check if current HEAD is detached\n> +sub git_is_head_detached {\n> +\tmy @x = (git_cmd(), 'branch');\n> +\tmy @ret = split(\"\\n\", qx(@x));\n> +\treturn 0 + grep { /^\\* \\(no branch\\)$/ } @ret;\n> +}\n\nFirst, not git-branch. Second, you can use Perl-only solution:\n\n+# check if current HEAD is detached\n+sub git_is_head_detached {\n+\tmy $head_file = \"$project/HEAD\";\n+\treturn if -l $head_file; # symlink\n+\topen my $fd, '<', $head_file\n+\t\tor return;\n+\tmy $head_hash = <$fd>;\n+\tclose $fd;\n+\treturn if $head_hash =~ /^ref: /;\n+\treturn $head_hash;\n+}\n\nAlternate solution would be to create git_get_symbolic_ref, and use\n\"!defined $current_branch\" in place of \"git_is_head_detached()\".\n\n> +\n>  # get type of given object\n>  sub git_get_type {\n>  \tmy $hash = shift;\n> @@ -2673,11 +2680,9 @@ sub git_get_heads_list {\n>  \tmy @headslist;\n>  \n>  \tif (grep { $_ eq 'heads' } @class) {\n> -\t\tmy @x = (git_cmd(), 'branch');\n> -\t\tmy @ret = split(\"\\n\", qx(@x));\n> -\t\tif (grep { /^\\* \\(no branch\\)$/ } @ret) { ;\n> +\t\tif (git_is_head_detached()) {\n>  \t\t\tmy %ref_item;\n> -\t\t\t@x = (git_cmd(), 'log', '-1', '--pretty=format:%H%n%ct%n%s');\n> +\t\t\tmy @x = (git_cmd(), 'log', '-1', '--pretty=format:%H%n%ct%n%s');\n\nHmmm... git-log, git-show, or perhaps parse_commit?\n\n>  \t\t\tmy ($hash, $epoch, $title) = split(\"\\n\", qx(@x), 3);\n>  \n>  \t\t\t$ref_item{'class'} = 'head';\n> -- \n> 1.5.6.5\n> \n> \n\n-- \nJakub Narebski\nPoland\n"},{"id":"95911","messageId":"200811160059.40402.jnareb@gmail.com","threadId":"16322","inReplyTo":"1226620461-25168-1-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH v2 10/11] gitweb: add HEAD to list of shortlog refs if detached","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-11-15T23:59:39Z","receivedAt":"2008-11-15T23:59:39Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Fri, 14 Nov 2008, Giuseppe Bilotta wrote:\n\n> Subject: [PATCH v2 10/11] gitweb: add HEAD to list of shortlog refs if detached\n\nErrr... what?!?\n\nIt is not \"list of shortlog refs\", it is list of _ref markers_.\n\n> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n> ---\n>  gitweb/gitweb.perl |    4 ++++\n>  1 files changed, 4 insertions(+), 0 deletions(-)\n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index ceb0271..256c962 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -2296,6 +2296,10 @@ sub git_get_last_activity {\n>  sub git_get_references {\n>  \tmy $type = shift || \"\";\n>  \tmy %refs;\n> +\tif (git_is_head_detached()) {\n> +\t\tmy $hash = git_get_head_hash($project);\n\n+\tif ($hash = git_is_head_detached()) {\n\nif using provided (in response to previous patch) implementation, but\neven that can be simplified out by using \"git show-ref -h ...\";\nsee below\n\n> +\t\t$refs{$hash} = [ 'HEAD' ];\n> +\t}\n\nOverly complicated. The '-h'/'--head' option to git-show-ref is there\nfor a reason.\n\n>  \t# 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c refs/tags/v2.6.11\n>  \t# c39ae07f393806ccf406ef966e9a15afc43cc36a refs/tags/v2.6.11^{}\n>  \topen my $fd, \"-|\", git_cmd(), \"show-ref\", \"--dereference\",\n>\t\t($type ? (\"--\", \"refs/$type\") : ()) # use -- <pattern> if $type\n\n-\t\t($type ? (\"--\", \"refs/$type\") : ()) # use -- <pattern> if $type\n+\t\t($type ? (\"--\", \"refs/$type\") : ('-h')) # use -- <pattern> if $type\n\n>\t\tor return;\n\nThis is I think simpler.\n\n-- \nJakub Narebski\nPoland\n"},{"id":"95912","messageId":"200811160108.56237.jnareb@gmail.com","threadId":"16322","inReplyTo":"1226620461-25168-2-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH v2 11/11] gitweb: CSS style and refs mark for detached HEAD","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-11-16T00:08:55Z","receivedAt":"2008-11-16T00:08:55Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Fri, 14 Nov 2008, Giuseppe Bilotta wrote:\n\n> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n> ---\n>  gitweb/gitweb.css  |    5 +++++\n>  gitweb/gitweb.perl |    2 +-\n>  2 files changed, 6 insertions(+), 1 deletions(-)\n> \n> diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css\n> index 751749f..c0c4540 100644\n> --- a/gitweb/gitweb.css\n> +++ b/gitweb/gitweb.css\n> @@ -523,6 +523,11 @@ span.refs span.head {\n>  \tborder-color: #ccffcc #00cc33 #00cc33 #ccffcc;\n>  }\n>  \n> +span.refs span.detached {\n> +\tbackground-color: #ffaaaa;\n> +\tborder-color: #ccffcc #00cc33 #00cc33 #ccffcc;\n> +}\n\nNice and good. I think.\n\n> +\n>  span.atnight {\n>  \tcolor: #cc0000;\n>  }\n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 256c962..51e133d 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -2298,7 +2298,7 @@ sub git_get_references {\n>  \tmy %refs;\n>  \tif (git_is_head_detached()) {\n>  \t\tmy $hash = git_get_head_hash($project);\n> -\t\t$refs{$hash} = [ 'HEAD' ];\n> +\t\t$refs{$hash} = [ 'detached/HEAD' ];\n\nThis, not so much.\n\nPlease, if you use some _*hack*_, and adding 'detached/' prefix is\ncertainly hack (you could have modified format_ref_marker() instead,\nand that is probably better solution), you really should explain it\nin detail in commit message.  Otherwise some time later somebody would\nexamine the code, say 'WTF?!?'... and even git-blame would not help ;-/\n\n>  \t}\n>  \t# 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c refs/tags/v2.6.11\n>  \t# c39ae07f393806ccf406ef966e9a15afc43cc36a refs/tags/v2.6.11^{}\n> -- \n> 1.5.6.5\n> \n> \n\n-- \nJakub Narebski\nPoland\n"},{"id":"95916","messageId":"200811160129.17319.jnareb@gmail.com","threadId":"16322","inReplyTo":"cb7bb73a0811150432s2f3ae4bfkc0fc29d92accc635@mail.gmail.com","subject":"Re: [PATCH v2 07/11] gitweb: add 'remotes' action","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-11-16T00:29:16Z","receivedAt":"2008-11-16T00:29:16Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Sat, 15 Nov 2008, Giuseppe Bilotta wrote:\n> On Sat, Nov 15, 2008 at 1:16 PM, Jakub Narebski <jnareb@gmail.com> wrote:\n>> On Thu, 13 Nov 2008, Giuseppe \"Oblomov\" Bilotta wrote:\n>>\n>>> This action is similar to the 'heads' action, but it displays\n>>> remote heads, grouped by remote repository.\n>>\n>> I think I would prefer would go together with the change that split\n>> the 'heads' ('branches') part of summary view into 'heads' and\n>> 'remotes', so that both section title header, and '...' continuation\n>> if present, lead to proper view.\n>>\n>> So either\n>>\n>>  [heads]  # or [branches]\n>>  master\n>>  to-submit\n>>  origin/master\n>>  origin/next\n>>  ...\n>>\n>> where both '[heads]' and (possibly) '...' link to 'heads' view showing\n>> _both_ local branches (refs/heads/*) and remote-tracking branches\n>> (refs/remotes/*), like in first patch of series (perhaps with some\n>> subdivision).\n>>\n>> Or\n>>\n>>  [heads]\n>>  master\n>>  to-submit\n>>  ...\n>>  [remotes]\n>>  origin/master\n>>  origin/next\n>>  ...\n>>\n>> where '[heads]' link to 'heads' view which shows only local branches\n>> (refs/heads/*), and '[remotes]' link to 'remotes' view which shows only\n>> remote-tracking branches.\n> \n> That's funny, I just squashed this patch with the summary list split\n> view patch 8-) I'm going for the second option, to have [heads] link\n> to heads which only lists local heads, and [remotes] linking to\n> remotes that lists the remotes. We may or may not want to rather have\n> [branches] instead of [heads], and keep the heads action to mean *all*\n> heads, local and remote, but I'm not sure about it.\n\nErrr... that was what I meant. First patch adding feature, and adding\nremotes (not separated) to 'heads' section and 'heads' view (it could\nhave renamed 'heads' section to 'branches' but I feel that unnecessary),\nand second patch squashed which adds 'remotes' section _and_ 'remotes'\naction.\n\n\n>> Nice. I see the difference from git_heads is using $project . ' remotes'\n>> in place of $project in git_print_header_div() (why?),\n> \n> FWIW, I decided to scratch that additional ' remotes' string when\n> squashing this patch.\n\nHmmm... I'm not sure if $project in git_print_header_div() for those\ntwo actions is good thing to have...\n\n-- \nJakub Narebski\nPoland\n"},{"id":"95919","messageId":"200811160213.43343.jnareb@gmail.com","threadId":"16322","inReplyTo":"cb7bb73a0811150204v15463275sf63098b819c6d259@mail.gmail.com","subject":"Re: [PATCH v2 05/11] gitweb: git_split_heads_body function.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-11-16T01:13:42Z","receivedAt":"2008-11-16T01:13:42Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Sat, 15 Nov 2008, Giuseppe Bilotta wrote:\n> On Sat, Nov 15, 2008 at 12:59 AM, Jakub Narebski <jnareb@gmail.com> wrote:\n>> On Thu, 13 Nov 2008, Giuseppe Bilotta wrote:\n>>\n>>> The purpose of this function is to split a headlist into groups\n>>> determined by the leading part of the refname, and call git_heads_body()\n>>> on each group.\n>>\n>> What is the reason of this patch? Is it to split remote-tracking\n>> branches ('remotes' references) into remotes, and group them by\n>> the remote repository name?\n>>\n>> If it is true, then first: you should have wrote the _reason_ behind\n>> this patch and not only what it does in this commit message. And use\n>> better summary (commit title / subject of this patch).\n>>\n>> Second, this patch wouldn't do what you want from it if there are\n>> remotes with '/' in name.  I for example use \"gsoc2008/gitweb-caching\"\n>> for Lea Wiemann repository with her GSoC 2008 work on adding caching\n>> to gitweb.  Because there are many ways to specify remotes due to\n>> backwards compatibility (and simplicity, as some for example prefer\n>> old 'branches/' way to specify remotes), namely config, files under\n>> '.git/remotes', and (from Cogito) files in '.git/branches', you would\n>> have to either reimplement/reuse parts of git-remote (there is old Perl\n>> implementation in contrib/examples), or use \"git remote\" or\n>> \"git remote -v\" command output[1].\n> \n> The initially intended purpose for this patch was to group remote\n> heads by remotes, but an interesting side-effect of doing it this way\n> was that it allowed to group _local_ heads too, by using the\n> stuff/morestuff syntax. For example, I could group gitweb/pathinfo and\n> gitweb/allheads together (although I disabled this grouping for local\n> heads in the patchset).\n\nI'm not sure if it would be that useful. How many people have _many_\nstuff/morestuff branches for some values of stuff/? The convention of\n<initials>/<topic> of topic branches in git.git doesn't usually lead\nto many branches with the same <initials>/ prefix.\n\n> \n> However, as you remark, the current patch fails to achieve even its\n> intended purpose, so it looks like going the 'git remote' way would be\n> the right way to find at least the grouping keys: this has the benefit\n> of allowing us to retrieve the remote URL as well by using 'git remote\n> -v', although it has the underside of require one additional git call.\n\nNow I thought about it a bit, I think your solution has merit. \n\nSplitting by remotes is hard and difficult to do right, especially if\nyou consider than 'remote' prefix doesn't need to have anything in\ncommon with names (common prefix) of refs/remotes/* remote-tracking\nbranches used. It is fairly easy to do it right in common case, but\nhard in uncommon one.\n\nSo perhaps the idea of using first dirname as a kind of category for\nremotes is a good idea. And usually it would be also remote name.\n\nBut it really needs explanation in commit message... and quite a bit\nof commit squashing.\n\n> \n> It would also probably be a good idea to separate the actual head\n> grouping from the display of the grouped head lists. I wonder if Perl\n> has a 'tree' data structure that could be used to store the grouped\n> head lists ...\n\nHash of hashes (well, hash references), see perldsc(1)?\n\n> \n> Ah yes, the code in this patch I was never actually really satisfied\n> with, hopefully I can rewrite it more sensibly with the adittional\n> experience I've accumulated this year.\n\nCode... well, perhaps... commit messages also matter.\n\n> \n>>> +\n>>> +     # Split @$headlist into a hash of lists\n>>> +     map {\n>>> +             my %ref = %$_;\n>>> +             $ref{'hname'} = $ref{'name'};\n>>> +             if ($ref{'name'} =~ /\\//) {\n>>> +                     $ref{'name'} =~ s!^([^/]+)/!!;\n>>\n>> As I said, this would fail on for example \"gsoc2008/gitweb-caching\"\n>> remote...\n> \n> Would you say that in this case we want 'gsoc2008/gitweb-caching' as\n> the group head, or would you rather have nested groups [gsoc2008\n> [gitweb-caching [branches in gsoc2008/gitweb-caching] [etc]] ? I must\n> say that I think the latter would be quite interesting, but I _am_ a\n> little afraid we could turn up with way too much nested groups ...\n\nNow I think that having [gsoc2008] subgroup here might be a good\nthing...\n\n-- \nJakub Narebski\nPoland\n"},{"id":"95927","messageId":"cb7bb73a0811151847r536e3e57wc1502bcf734e7930@mail.gmail.com","threadId":"16322","inReplyTo":"200811160129.17319.jnareb@gmail.com","subject":"Re: [PATCH v2 07/11] gitweb: add 'remotes' action","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-16T02:47:55Z","receivedAt":"2008-11-16T02:47:55Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Sun, Nov 16, 2008 at 1:29 AM, Jakub Narebski <jnareb@gmail.com> wrote:\n> On Sat, 15 Nov 2008, Giuseppe Bilotta wrote:\n>> FWIW, I decided to scratch that additional ' remotes' string when\n>> squashing this patch.\n>\n> Hmmm... I'm not sure if $project in git_print_header_div() for those\n> two actions is good thing to have...\n\nConsidering it links back to summary view, it makes sense to say\n$project in there.  If we decide to make it link to something else, we\nshould change the text accordingly. Suggestions?\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"95928","messageId":"cb7bb73a0811151853r418f02ear2f50518f89577054@mail.gmail.com","threadId":"16322","inReplyTo":"200811160213.43343.jnareb@gmail.com","subject":"Re: [PATCH v2 05/11] gitweb: git_split_heads_body function.","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-16T02:53:31Z","receivedAt":"2008-11-16T02:53:31Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Sun, Nov 16, 2008 at 2:13 AM, Jakub Narebski <jnareb@gmail.com> wrote:\n> On Sat, 15 Nov 2008, Giuseppe Bilotta wrote:\n>> The initially intended purpose for this patch was to group remote\n>> heads by remotes, but an interesting side-effect of doing it this way\n>> was that it allowed to group _local_ heads too, by using the\n>> stuff/morestuff syntax. For example, I could group gitweb/pathinfo and\n>> gitweb/allheads together (although I disabled this grouping for local\n>> heads in the patchset).\n>\n> I'm not sure if it would be that useful. How many people have _many_\n> stuff/morestuff branches for some values of stuff/? The convention of\n> <initials>/<topic> of topic branches in git.git doesn't usually lead\n> to many branches with the same <initials>/ prefix.\n\nWell, even if it's just two of them, it would still be nice. Or even\nbetter, we could make it so that the grouping is skipped unless there\nare at least N (to be decided) entries. This, btw, would be true for\nthe remotes idea too.\n\n> Now I thought about it a bit, I think your solution has merit.\n>\n> Splitting by remotes is hard and difficult to do right, especially if\n> you consider than 'remote' prefix doesn't need to have anything in\n> common with names (common prefix) of refs/remotes/* remote-tracking\n> branches used. It is fairly easy to do it right in common case, but\n> hard in uncommon one.\n>\n> So perhaps the idea of using first dirname as a kind of category for\n> remotes is a good idea. And usually it would be also remote name.\n>\n> But it really needs explanation in commit message... and quite a bit\n> of commit squashing.\n\nI'll probably do a single commit with a rather different logic than\nthe current one, too.\n\n>> It would also probably be a good idea to separate the actual head\n>> grouping from the display of the grouped head lists. I wonder if Perl\n>> has a 'tree' data structure that could be used to store the grouped\n>> head lists ...\n>\n> Hash of hashes (well, hash references), see perldsc(1)?\n\nAh, good, I always get those wrong. Will be an interesting challenge 8-D\n\n>> Would you say that in this case we want 'gsoc2008/gitweb-caching' as\n>> the group head, or would you rather have nested groups [gsoc2008\n>> [gitweb-caching [branches in gsoc2008/gitweb-caching] [etc]] ? I must\n>> say that I think the latter would be quite interesting, but I _am_ a\n>> little afraid we could turn up with way too much nested groups ...\n>\n> Now I think that having [gsoc2008] subgroup here might be a good\n> thing...\n\nAnd subgroups (one for each remote) therein?\n\nMy idea would be that, if you only have\ngsoc2008/gitweb-caching/branch[1-n], then you'd have a\ngsoc2008/gitweb-caching group, and branch1 ... branchn as entries. If\nOTOH we have gsoc2007/{gitweb-caching,gitstats}/branch*, we'd have\ngsoc2008 group with gitweb-caching and gitstats subgroups, each with\nits list of branches.\n\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"95935","messageId":"200811161312.50090.jnareb@gmail.com","threadId":"16322","inReplyTo":"cb7bb73a0811150425j2475db8dsdee57c1cc5e208ab@mail.gmail.com","subject":"Re: [PATCH v2 05/11] gitweb: git_split_heads_body function.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-11-16T12:12:48Z","receivedAt":"2008-11-16T12:12:48Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Giuseppe Bilotta wrote:\n> On Sat, Nov 15, 2008 at 1:14 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Jakub Narebski <jnareb@gmail.com> writes:\n>>\n>>> Second, this patch wouldn't do what you want from it if there are\n>>> remotes with '/' in name.  I for example use \"gsoc2008/gitweb-caching\"\n>>> for Lea Wiemann repository with her GSoC 2008 work on adding caching\n>>> to gitweb.\n>>\n>> I think your point is if you also use gsoc2008/gitstats from another\n>> remote repository, these two sets of remote tracking branches will be\n>> shown grouped together.  But is it a bad thing?  After all, you chose to\n>> use hierarchical names for them, _and_ you chose to use the same toplevel\n>> hierarchy name for them.  Doesn't that mean you _wanted_ to have them both\n>> appear in the same GSoC 2008 group?\n\nActually I _don't_ have 'gsoc2008/gitstats' remote, nor gsoc2008/gitstats/*\nremote-tracking branches. 'gsoc2008/gitweb-caching' is the only remote\nwith hierarchical name. But I digress...\n\n> The problem is that we have gsoc2008/gitweb-caching/branch1\n> gsoc2008/gitweb-caching/branch2 gsoc2008/gitstats/branch3\n> gsoc2008/gitstats/branch3, and my current code would show\n> gitweb-caching/branch1, gitweb-caching/branch2 etc under gsoc2008.\n\nI'm not sure if it wouldn't be simpler solution to just code _sorting_\nheads-like view ('heads', 'remotes', 'tags') by ref name, or by age.\nIt would be best to have both, even...\n\nEven without dividing 'remotes' view into subcategories (and\nsubsubcategories) you would have natural grouping:\n\n gsoc2008/gitweb-caching/branch1\n gsoc2008/gitweb-caching/branch2\n gsoc2008/gitstats/branch3\n gsoc2008/gitstats/branch4\n\nif sorted by branch (ref) name, and not (possibly)\n\n gsoc2008/gitweb-caching/branch1\n gsoc2008/gitstats/branch4\n origin/todo\n gsoc2008/gitweb-caching/branch2\n gsoc2008/gitstats/branch3\n\nwhen sorted by age (hmmm... committerdate or authordate?)\n\n> Having branch1 and branch2 under gsoc2008/gitweb-caching, and branch3\n> and branch4 under gsoc2008/gitstats would be more logical,\n> remote-wise, but it would of course lose the coupling between all the\n> gsoc2008 remotes.\n> \n> If deep nesting is not a problem, I can code something to have\n> gitweb-caching and gistats under gsoc2008, and the respective branches\n> within.\n\nThe problems with nesting is those pesky remotes with only single\ntracked branch to them; they are I think quote common... well, unless\nyou do one-shot pull, directly into local branch.\n\nAll that said, splitting 'remotes' section is difficult; using first\ndirname as section is probably easiest, and good enough in most cases.\nThat is why I think this part should be put into separate series, to\nnot hinder rest of patches.\n\n-- \nJakub Narebski\nPoland\n"},{"id":"95936","messageId":"cb7bb73a0811160426g1e56faa7ia9b1f398fea039a8@mail.gmail.com","threadId":"16322","inReplyTo":"200811161312.50090.jnareb@gmail.com","subject":"Re: [PATCH v2 05/11] gitweb: git_split_heads_body function.","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-16T12:26:09Z","receivedAt":"2008-11-16T12:26:09Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Sun, Nov 16, 2008 at 1:12 PM, Jakub Narebski <jnareb@gmail.com> wrote:\n> Giuseppe Bilotta wrote:\n>> The problem is that we have gsoc2008/gitweb-caching/branch1\n>> gsoc2008/gitweb-caching/branch2 gsoc2008/gitstats/branch3\n>> gsoc2008/gitstats/branch3, and my current code would show\n>> gitweb-caching/branch1, gitweb-caching/branch2 etc under gsoc2008.\n>\n> I'm not sure if it wouldn't be simpler solution to just code _sorting_\n> heads-like view ('heads', 'remotes', 'tags') by ref name, or by age.\n> It would be best to have both, even...\n>\n> Even without dividing 'remotes' view into subcategories (and\n> subsubcategories) you would have natural grouping:\n>\n>  gsoc2008/gitweb-caching/branch1\n>  gsoc2008/gitweb-caching/branch2\n>  gsoc2008/gitstats/branch3\n>  gsoc2008/gitstats/branch4\n>\n> if sorted by branch (ref) name, and not (possibly)\n>\n>  gsoc2008/gitweb-caching/branch1\n>  gsoc2008/gitstats/branch4\n>  origin/todo\n>  gsoc2008/gitweb-caching/branch2\n>  gsoc2008/gitstats/branch3\n>\n> when sorted by age (hmmm... committerdate or authordate?)\n\nSorting is another interesting feature to look into, yes, but as you\nmention it's a separate feature that would complement grouping.\n\n>> Having branch1 and branch2 under gsoc2008/gitweb-caching, and branch3\n>> and branch4 under gsoc2008/gitstats would be more logical,\n>> remote-wise, but it would of course lose the coupling between all the\n>> gsoc2008 remotes.\n>>\n>> If deep nesting is not a problem, I can code something to have\n>> gitweb-caching and gistats under gsoc2008, and the respective branches\n>> within.\n>\n> The problems with nesting is those pesky remotes with only single\n> tracked branch to them; they are I think quote common... well, unless\n> you do one-shot pull, directly into local branch.\n\nMy idea with this would be to only create a group if it has at least N\n> 1 (probably N=2) entries.\n\n> All that said, splitting 'remotes' section is difficult; using first\n> dirname as section is probably easiest, and good enough in most cases.\n> That is why I think this part should be put into separate series, to\n> not hinder rest of patches.\n\nYes, I will resend the 'remote_heads' feature as a new (reduced)\npatchset, then add (separate patchset) grouping for ref lists, and\nthen add (yet another patchset) detached head.\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"95945","messageId":"200811161521.53993.jnareb@gmail.com","threadId":"16322","inReplyTo":"cb7bb73a0811160426g1e56faa7ia9b1f398fea039a8@mail.gmail.com","subject":"Re: [PATCH v2 05/11] gitweb: git_split_heads_body function.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-11-16T14:21:53Z","receivedAt":"2008-11-16T14:21:53Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Giuseppe Bilotta wrote:\n> On Sun, Nov 16, 2008 at 1:12 PM, Jakub Narebski <jnareb@gmail.com> wrote:\n\n>> The problems with nesting is those pesky remotes with only single\n>> tracked branch to them; they are I think quote common... well, unless\n>> you do one-shot pull, directly into local branch.\n> \n> My idea with this would be to only create a group if it has at least\n> N > 1 (probably N=2) entries.\n\nA bit of complication is that you would have then series of\n'uncategorized' (not in any subsection) entries / remote-tracking\nbranches.\n\n>> All that said, splitting 'remotes' section is difficult; using first\n>> dirname as section is probably easiest, and good enough in most cases.\n>> That is why I think this part should be put into separate series, to\n>> not hinder rest of patches.\n> \n> Yes, I will resend the 'remote_heads' feature as a new (reduced)\n> patchset, then add (separate patchset) grouping for ref lists, and\n> then add (yet another patchset) detached head.\n\nThat is I think a good idea.\n\nP.S. I think that sending this patch series for review, even if it was\nnot perfect was a very good idea... well, perhaps some patches could\nbe marked as RFC.\n\nIt is hard work to prepare good patches, then wait for review, then\nwait a bit that there is no further review, working on the patches,\nresend and wait for review, or for Ack and merge-in... Keep up good\nwork.\n\n-- \nJakub Narebski\nPoland\n"},{"id":"95948","messageId":"cb7bb73a0811160728t1a99aedbm400b41d402115ade@mail.gmail.com","threadId":"16322","inReplyTo":"200811161521.53993.jnareb@gmail.com","subject":"Re: [PATCH v2 05/11] gitweb: git_split_heads_body function.","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-11-16T15:28:08Z","receivedAt":"2008-11-16T15:28:08Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Sun, Nov 16, 2008 at 3:21 PM, Jakub Narebski <jnareb@gmail.com> wrote:\n> Giuseppe Bilotta wrote:\n>> On Sun, Nov 16, 2008 at 1:12 PM, Jakub Narebski <jnareb@gmail.com> wrote:\n>\n>>> The problems with nesting is those pesky remotes with only single\n>>> tracked branch to them; they are I think quote common... well, unless\n>>> you do one-shot pull, directly into local branch.\n>>\n>> My idea with this would be to only create a group if it has at least\n>> N > 1 (probably N=2) entries.\n>\n> A bit of complication is that you would have then series of\n> 'uncategorized' (not in any subsection) entries / remote-tracking\n> branches.\n\nWe'll put them in their own group 8-)\n\n>> Yes, I will resend the 'remote_heads' feature as a new (reduced)\n>> patchset, then add (separate patchset) grouping for ref lists, and\n>> then add (yet another patchset) detached head.\n>\n> That is I think a good idea.\n>\n> P.S. I think that sending this patch series for review, even if it was\n> not perfect was a very good idea... well, perhaps some patches could\n> be marked as RFC.\n\nThat's what they were when I first sent them last year 8-)\n\n> It is hard work to prepare good patches, then wait for review, then\n> wait a bit that there is no further review, working on the patches,\n> resend and wait for review, or for Ack and merge-in... Keep up good\n> work.\n\nThanks.\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"}]}