{"thread":{"id":"9680","subject":"gitweb and remote branches","startedAt":"2007-08-27T22:24:04Z","lastAt":"2007-08-31T11:19:14Z","messageCount":25,"participants":["Giuseppe Bilotta","Jakub Narebski","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"51759","messageId":"favitd$3ff$1@sea.gmane.org","threadId":"9680","inReplyTo":null,"subject":"gitweb and remote branches","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-27T22:24:04Z","receivedAt":"2007-08-27T22:24:04Z","isPatch":false,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"Hello all,\n\nCurrently, remote branch heads are only shown in the\nshortlog, but I would like them to appear in the heads list,\ntogether with the local branches. Is there some option for it?\nI've browsed the gitweb source but I haven't found anything\nthat looked like it.\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"51771","messageId":"favmoh$aqr$2@sea.gmane.org","threadId":"9680","inReplyTo":"favitd$3ff$1@sea.gmane.org","subject":"Re: gitweb and remote branches","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-08-27T23:29:25Z","receivedAt":"2007-08-27T23:29:25Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"[Cc: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>, git@vger.kernel.org]\n\nGiuseppe Bilotta wrote:\n\n> Currently, remote branch heads are only shown in the\n> shortlog, but I would like them to appear in the heads list,\n> together with the local branches. Is there some option for it?\n> I've browsed the gitweb source but I haven't found anything\n> that looked like it.\n\nIt is on my [long] TODO list for gitweb. But thanks for reminding\nit.\n\nQuick and dirty hack would be to change git for 'heads' view to accept\n'-a' (all branches) extra option...\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"51859","messageId":"200708300001.39203.jnareb@gmail.com","threadId":"9680","inReplyTo":"cb7bb73a0708280453k4315e80ej170238a52e66dcb6@mail.gmail.com","subject":"Re: gitweb and remote branches","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-08-29T22:01:38Z","receivedAt":"2007-08-29T22:01:38Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Tue, 28 August 2007, Giuseppe Bilotta wrote:\n> On 8/28/07, Giuseppe Bilotta <giuseppe.bilotta@gmail.com> wrote:\n>>\n>> I've given a better look at the code and I think I can whip up a patch\n>> to implement the feature. I have no idea about how to create a new\n>> option in gitweb though, so I'll have to leave it that to someone\n>> else.\n> \n> Ok, this is hopefully the last time I reply to myself. I'm inlining\n> the quick'n'dirty patch I've whipped up, hoping that gmail doesn't\n> destroy it too much..\n\nFor quick'n'dirty solution this might be enough. For proper patch to\nbe accepted I don't think so.\n\nFirst, in the idea to show also remote branches (from refs/remotes),\nI wanted to separate heads list from remotes list in the 'summary'\nview, and add 'remotes' view or modify 'heads' view to accept some\nparameter specyfying kind of refs.\n\nSecond, what was stopping me from implementing that was an idea to\nseparate remote branches into categories (like gitwbe-xmms2 categories\nof projects) defined by the remote it belongs to. And this is not so\neasy if we want to respect old .git/branches/ and .git/remotes/ remote\nconfig in addition to new config based remote config.\n\n> -- \n> Giuseppe \"Oblomov\" Bilotta\n> \n> --- gitweb.cgi\t2007-08-26 12:41:13.000000000 +0200\n> +++ gitweb.cgi-my\t2007-08-28 13:47:15.000000000 +0200\n\nIt is better to use git to manage source and to generate patches\n(use git-format-patch, check Documentation/SubmittingPatches),\nand use gitweb/gitweb.perl and not installed version.\n\n[...]\n> @@ -1677,8 +1677,9 @@ sub git_get_heads_list {\n>  \t\tmy ($hash, $name, $title) = split(' ', $refinfo, 3);\n>  \t\tmy ($committer, $epoch, $tz) =\n>  \t\t\t($committerinfo =~ /^(.*) ([0-9]+) (.*)$/);\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\nNice, although very minor nit: I'd use\n\n> +\t\t$ref_item{'class'} = $1;\n\n\n> @@ -3237,8 +3238,10 @@ sub git_heads_body {\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      \"<span class=\\\"refs\\\"><span class=\\\"$ref{'class'}\\\">\" .\n>  \t\t      $cgi->a({-href => href(action=>\"shortlog\", hash=>$ref{'name'}),\n>  \t\t               -class => \"list name\"},esc_html($ref{'name'})) .\n> +\t\t      \"</span></span>\" .\n>  \t\t      \"</td>\\n\" .\n>  \t\t      \"<td class=\\\"link\\\">\" .\n>  \t\t      $cgi->a({-href => href(action=>\"shortlog\",\n> hash=>$ref{'name'})}, \"shortlog\") . \" | \" .\n> \n\nI don't understand this double span. First, you can set multiple\nclasses for HTML element by separating them by space, e.g.\n\n\t\t\"<span class=\\\"refs\\ $ref{'class'}\\\">\"\n\nAnd you could have given appropriate class to <td> or <a> element\n\n-- \nJakub Narebski\nPoland\n"},{"id":"51878","messageId":"cb7bb73a0708300018u37f5c465u5d87eae0eb23543c@mail.gmail.com","threadId":"9680","inReplyTo":"200708300001.39203.jnareb@gmail.com","subject":"Re: gitweb and remote branches","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-30T07:18:09Z","receivedAt":"2007-08-30T07:18:09Z","isPatch":false,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On 8/30/07, Jakub Narebski <jnareb@gmail.com> wrote:\n> For quick'n'dirty solution this might be enough. For proper patch to\n> be accepted I don't think so.\n\nThat's fine, it wasn't meant to be :)\n\n> First, in the idea to show also remote branches (from refs/remotes),\n> I wanted to separate heads list from remotes list in the 'summary'\n> view, and add 'remotes' view or modify 'heads' view to accept some\n> parameter specyfying kind of refs.\n\nWhat I had in mind was a way to modify 'heads' view with a boolean\noption that enable/disabled remotes view. For their visualizations, I\nhad in mind a split 'heads' secion, with the lhs being as it is now,\nand the rhs having the remotes.\n\nHowever, I wasn't sure if such a view would have been appreciated, so\nI went for the merged view and used the spans to make the heads appear\nas they do in the shortlog, as a clear way to mark which ones were\nlocal and which ones were remote.\n\n> Second, what was stopping me from implementing that was an idea to\n> separate remote branches into categories (like gitwbe-xmms2 categories\n> of projects) defined by the remote it belongs to. And this is not so\n> easy if we want to respect old .git/branches/ and .git/remotes/ remote\n> config in addition to new config based remote config.\n\nI don't know what gitweb-xmms2 does, but I think I understand what you\nmean, and I like the idea. However, it's even harder if you consider\nthat even the latest git-svn plops all the svn-converted refs straight\ninto refs/remotes and not in a subdir such as refs/remotes/svn.\n\nOTOH, we have to start from somewhere so we can build the feature step by step.\n\n> > Giuseppe \"Oblomov\" Bilotta\n> >\n> > --- gitweb.cgi        2007-08-26 12:41:13.000000000 +0200\n> > +++ gitweb.cgi-my     2007-08-28 13:47:15.000000000 +0200\n>\n> It is better to use git to manage source and to generate patches\n> (use git-format-patch, check Documentation/SubmittingPatches),\n> and use gitweb/gitweb.perl and not installed version.\n\nOh, I know, this was just a very quick hack on the thing installed by\nmy Debian distribution. I've since checkoued out the git.git\nrepository and I'll be working on that now.\n\n> > @@ -3237,8 +3238,10 @@ sub git_heads_body {\n> >               $alternate ^= 1;\n> >               print \"<td><i>$ref{'age'}</i></td>\\n\" .\n> >                     ($curr ? \"<td class=\\\"current_head\\\">\" : \"<td>\") .\n> > +                   \"<span class=\\\"refs\\\"><span class=\\\"$ref{'class'}\\\">\" .\n> >                     $cgi->a({-href => href(action=>\"shortlog\", hash=>$ref{'name'}),\n> >                              -class => \"list name\"},esc_html($ref{'name'})) .\n> > +                   \"</span></span>\" .\n> >                     \"</td>\\n\" .\n> >                     \"<td class=\\\"link\\\">\" .\n> >                     $cgi->a({-href => href(action=>\"shortlog\",\n> > hash=>$ref{'name'})}, \"shortlog\") . \" | \" .\n> >\n>\n> I don't understand this double span. First, you can set multiple\n> classes for HTML element by separating them by space, e.g.\n>\n>                 \"<span class=\\\"refs\\ $ref{'class'}\\\">\"\n>\n> And you could have given appropriate class to <td> or <a> element\n\nActually, that was just a quick hack to make the heads appear in the\nheads list in the same way as they appear in the shortlog, to\ndifferentiate between them. And that requires the double span ;)\n\nOf course, I'd rather hack the CSS now that I've got the git repository.\n\nI'll be working on it here\n\nhttp://oblomov.dnsalias.org/git?p=git.git;a=shortlog;h=gitweb-allheads\n\nand keep you posted on my progress.\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"51882","messageId":"200708301016.17552.jnareb@gmail.com","threadId":"9680","inReplyTo":"cb7bb73a0708300018u37f5c465u5d87eae0eb23543c@mail.gmail.com","subject":"Re: gitweb and remote branches","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-08-30T08:16:15Z","receivedAt":"2007-08-30T08:16:15Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Thu, 30 August 2007, Giuseppe Bilotta wrote:\n> On 8/30/07, Jakub Narebski <jnareb@gmail.com> wrote:\n\n>> First, in the idea to show also remote branches (from refs/remotes),\n>> I wanted to separate heads list from remotes list in the 'summary'\n>> view, and add 'remotes' view or modify 'heads' view to accept some\n>> parameter specyfying kind of refs.\n> \n> What I had in mind was a way to modify 'heads' view with a boolean\n> option that enable/disabled remotes view.\n\nThat is a good idea. We can for example use extra_options ('opt')\nparameter to pass 'refs/remotes' etc. to 'heads' view. Or we can\nuse some new CGI parameter. Or just make it configurable in gitweb\nconfiguration, with per repository override, i.e. make it into\n%feature.\n\n> For their visualizations, I \n> had in mind a split 'heads' secion, with the lhs being as it is now,\n> and the rhs having the remotes.\n\nCare to provide some ascii-art mockup?\n\nWhat I had in mind was for 'summary' view (*bold*, _underline_):\n\n  [heads]\n  27 min ago       _gitweb-allheads_   shortlog | log | tree\n  24 hours ago     master \t       shortlog | log | tree\n\n  [remotes]\n  *origin*\n    24 hours ago    man        shortlog | log | tree\n    24 hours ago    html       shortlog | log | tree\n    24 hours ago    next       shortlog | log | tree\n    24 hours ago    pu         shortlog | log | tree\n    24 hours ago    _master_   shortlog | log | tree\n    2 weeks ago     maint      shortlog | log | tree\n    2 weeks ago     todo       shortlog | log | tree\n\nand similarly for 'remotes' view (or 'heads').\n\nNote that we remove remote name from remote branch name, although\nwe can leave it as is (i.e. origin/man vs. man), and that we filter\nout HEAD if it points to existing branch, marking one of the branches\nas current instead.\n\nThat reminds me that gitweb has no support for detached HEAD as of yet,\nalthough I don't think we want to encourage detached HEAD in public \nrepo.\n\n> However, I wasn't sure if such a view would have been appreciated, so\n> I went for the merged view and used the spans to make the heads appear\n> as they do in the shortlog, as a clear way to mark which ones were\n> local and which ones were remote.\n\nOn\n\n  http://oblomov.dnsalias.org/git?p=git.git;a=heads\n\nI don't see any difference between formatting of remote heads and local\nbranches.\n \n>> Second, what was stopping me from implementing that was an idea to\n>> separate remote branches into categories (like gitwbe-xmms2\n>> categories of projects) defined by the remote it belongs to. And\n>> this is not so easy if we want to respect old .git/branches/\n>> and .git/remotes/ remote config in addition to new config based\n>> remote config. \n> \n> I don't know what gitweb-xmms2 does, but I think I understand what you\n> mean, and I like the idea.\n\nSee my mockup and 'summary' view of gitweb-xmms2 installation:\n  http://git.xmms.se/\n\n> However, it's even harder if you consider \n> that even the latest git-svn plops all the svn-converted refs straight\n> into refs/remotes and not in a subdir such as refs/remotes/svn.\n\nOr refs/svn. I think that dumping remotes directly into refs/remotes\nand not to refs/remotes/<remote> is a bug (also in git-svn).\n\n> OTOH, we have to start from somewhere so we can build the feature\n> step by step. \n\nWe can start without separating into remotes category-like, i.e.\nwith the following mockup:\n\n  [remotes]\n    24 hours ago    origin/man        shortlog | log | tree\n    24 hours ago    origin/html       shortlog | log | tree\n    24 hours ago    origin/next       shortlog | log | tree\n    24 hours ago    origin/pu         shortlog | log | tree\n    24 hours ago    _origin/master_   shortlog | log | tree\n    2 weeks ago     origin/maint      shortlog | log | tree\n    2 weeks ago     origin/todo       shortlog | log | tree\n\n \n[...]\n\n> I'll be working on it here\n> \n> http://oblomov.dnsalias.org/git?p=git.git;a=shortlog;h=gitweb-allheads\n> \n> and keep you posted on my progress.\n\nYou can also make a git fork at http://repo.or.cz\n\n-- \nJakub Narebski\nPoland\n"},{"id":"51885","messageId":"cb7bb73a0708300209g564284f8w900db693485acdb7@mail.gmail.com","threadId":"9680","inReplyTo":"200708301016.17552.jnareb@gmail.com","subject":"Re: gitweb and remote branches","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-30T09:09:05Z","receivedAt":"2007-08-30T09:09:05Z","isPatch":false,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On 8/30/07, Jakub Narebski <jnareb@gmail.com> wrote:\n> On Thu, 30 August 2007, Giuseppe Bilotta wrote:\n> > What I had in mind was a way to modify 'heads' view with a boolean\n> > option that enable/disabled remotes view.\n>\n> That is a good idea. We can for example use extra_options ('opt')\n> parameter to pass 'refs/remotes' etc. to 'heads' view. Or we can\n> use some new CGI parameter. Or just make it configurable in gitweb\n> configuration, with per repository override, i.e. make it into\n> %feature.\n\nFor the time being I've made it into a project-overridable %feature.\n(It was easier to set up than I though.) I do like the idea of having\nit also as an additional CGI parameter.\n\n> > For their visualizations, I\n> > had in mind a split 'heads' secion, with the lhs being as it is now,\n> > and the rhs having the remotes.\n>\n> Care to provide some ascii-art mockup?\n\n(monospace view)\n\n[heads]                | [remotes]\ndate headname links    | date headname links\ndate headname links    | date headname links\n\nor a variation thereof. However, I have a 1600x1200 screen so not\neverybody might be confortable with such a view.\n\n> What I had in mind was for 'summary' view (*bold*, _underline_):\n>\n>   [heads]\n>   27 min ago       _gitweb-allheads_   shortlog | log | tree\n>   24 hours ago     master              shortlog | log | tree\n>\n>   [remotes]\n>   *origin*\n>     24 hours ago    man        shortlog | log | tree\n>     24 hours ago    html       shortlog | log | tree\n>     24 hours ago    next       shortlog | log | tree\n>     24 hours ago    pu         shortlog | log | tree\n>     24 hours ago    _master_   shortlog | log | tree\n>     2 weeks ago     maint      shortlog | log | tree\n>     2 weeks ago     todo       shortlog | log | tree\n>\n> and similarly for 'remotes' view (or 'heads').\n\nI think I like yours better. I had just implemented split\nremotes/heads list in summary view, so I'll keep working towards your\nidea.\n\n> Note that we remove remote name from remote branch name, although\n> we can leave it as is (i.e. origin/man vs. man),\n\nYes, I'll work on this next.\n\n> and that we filter\n> out HEAD if it points to existing branch, marking one of the branches\n> as current instead.\n\nI don't know if I'll be able to implement this, but I'll try :)\n\n> > However, I wasn't sure if such a view would have been appreciated, so\n> > I went for the merged view and used the spans to make the heads appear\n> > as they do in the shortlog, as a clear way to mark which ones were\n> > local and which ones were remote.\n>\n> On\n>\n>   http://oblomov.dnsalias.org/git?p=git.git;a=heads\n>\n> I don't see any difference between formatting of remote heads and local\n> branches.\n\nIndeed, I removed the thing when I started working on the repo.\n\n> > However, it's even harder if you consider\n> > that even the latest git-svn plops all the svn-converted refs straight\n> > into refs/remotes and not in a subdir such as refs/remotes/svn.\n>\n> Or refs/svn. I think that dumping remotes directly into refs/remotes\n> and not to refs/remotes/<remote> is a bug (also in git-svn).\n\nI think so too. I'll report it as a bug to the git-svn developers.\n\n> > I'll be working on it here\n> >\n> > http://oblomov.dnsalias.org/git?p=git.git;a=shortlog;h=gitweb-allheads\n> >\n> > and keep you posted on my progress.\n>\n> You can also make a git fork at http://repo.or.cz\n\nOh, interesting. Just clicking on the 'fork' link in\nhttp://repo.or.cz/w/git/gitweb.git and filling up the form?\n\nI'll set that up as a mirror shortly.\n\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"51942","messageId":"7vbqco91fi.fsf@gitster.siamese.dyndns.org","threadId":"9680","inReplyTo":"200708301016.17552.jnareb@gmail.com","subject":"Re: gitweb and remote branches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-30T21:07:13Z","receivedAt":"2007-08-30T21:07:13Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> That reminds me that gitweb has no support for detached HEAD as of yet,\n> although I don't think we want to encourage detached HEAD in public \n> repo.\n\nThat logic is flawed, I am afraid.  If you have been talking\nonly about serving public repository via gitweb, then the topic\nof the thread becomes totally moot.  Exposing or even having\nremotes/ in public distribution point repository would be even\nmore wrong than using detached HEAD in public repository.  Other\npeople who interact with you should not have any business what\nyou happened to have fetched from _your_ upstream --- if you\nwant to publish them and act as a relay for your downstream,\nthen they should be fetched from your branch namespace.\n\nBut obviously people use gitweb/instaweb as a way to view their\nown live repository, and I think it makes sense to show and\nsupport remotes/ in such a case.  It also would make sense to\nsupport detached HEAD there as well.\n"},{"id":"51960","messageId":"cb7bb73a0708301609s330f8d6fna3755bff346452ab@mail.gmail.com","threadId":"9680","inReplyTo":"7vbqco91fi.fsf@gitster.siamese.dyndns.org","subject":"Re: gitweb and remote branches","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-30T23:09:28Z","receivedAt":"2007-08-30T23:09:28Z","isPatch":false,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On 8/30/07, Junio C Hamano <gitster@pobox.com> wrote:\n> Jakub Narebski <jnareb@gmail.com> writes:\n>\n> > That reminds me that gitweb has no support for detached HEAD as of yet,\n> > although I don't think we want to encourage detached HEAD in public\n> > repo.\n>\n> That logic is flawed, I am afraid.  If you have been talking\n> only about serving public repository via gitweb, then the topic\n> of the thread becomes totally moot.  Exposing or even having\n> remotes/ in public distribution point repository would be even\n> more wrong than using detached HEAD in public repository.  Other\n> people who interact with you should not have any business what\n> you happened to have fetched from _your_ upstream --- if you\n> want to publish them and act as a relay for your downstream,\n> then they should be fetched from your branch namespace.\n\nOTOH, having 'origin' exposed, and knowing the 'origin' URL, would\nopen lots of interesting fields of research, such as distributed git\nmirroring to download large repositories from more than a client etc.\n\nAnyway, making visible remotes an option that defaults to disabled\nwould address both the issue above and the one below:\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\nIf I understand correctly, a detached HEAD is simply a checkout in the\nmiddle of a branch, and thus not named. So what exactly are we looking\nfor when we talk about supporting a detached HEAD? Would it be enough\nto display HEAD in the list of heads?\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"51965","messageId":"200708310153.29625.jnareb@gmail.com","threadId":"9680","inReplyTo":"cb7bb73a0708301609s330f8d6fna3755bff346452ab@mail.gmail.com","subject":"Re: gitweb and remote branches","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-08-30T23:53:28Z","receivedAt":"2007-08-30T23:53:28Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Fri, 31 August 2007, Giuseppe Bilotta wrote:\n> On 8/30/07, Junio C Hamano <gitster@pobox.com> wrote:\n>> Jakub Narebski <jnareb@gmail.com> writes:\n>>\n>>> That reminds me that gitweb has no support for detached HEAD as of yet,\n>>> although I don't think we want to encourage detached HEAD in public\n>>> repo.\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> \n> If I understand correctly, a detached HEAD is simply a checkout in the\n> middle of a branch, and thus not named. So what exactly are we looking\n> for when we talk about supporting a detached HEAD? Would it be enough\n> to display HEAD in the list of heads?\n\nI think we want display HEAD in the list of heads if it is detached,\nand also use it as a ref marker, while only marking (with undeline or\nbold style) current head as such if HEAD is not detached, i.e. is\nsymref or symlink.\n\n-- \nJakub Narebski\nPoland\n"},{"id":"51966","messageId":"cb7bb73a0708301659q6ccc1211w2c7ce315051a605e@mail.gmail.com","threadId":"9680","inReplyTo":"200708310153.29625.jnareb@gmail.com","subject":"Re: gitweb and remote branches","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-30T23:59:19Z","receivedAt":"2007-08-30T23:59:19Z","isPatch":false,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On 8/31/07, Jakub Narebski <jnareb@gmail.com> wrote:\n> On Fri, 31 August 2007, Giuseppe Bilotta wrote:\n> > If I understand correctly, a detached HEAD is simply a checkout in the\n> > middle of a branch, and thus not named. So what exactly are we looking\n> > for when we talk about supporting a detached HEAD? Would it be enough\n> > to display HEAD in the list of heads?\n>\n> I think we want display HEAD in the list of heads if it is detached,\n> and also use it as a ref marker, while only marking (with undeline or\n> bold style) current head as such if HEAD is not detached, i.e. is\n> symref or symlink.\n\nI thought so.\n\nOf course, I've just discovered that for-each-ref ignores HEAD, so I\nhave to do it the hard route ...\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"51976","messageId":"cb7bb73a0708301915y47ca4a05nf511889b2bb2eaec@mail.gmail.com","threadId":"9680","inReplyTo":"cb7bb73a0708301659q6ccc1211w2c7ce315051a605e@mail.gmail.com","subject":"Re: gitweb and remote branches","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-31T02:15:40Z","receivedAt":"2007-08-31T02:15:40Z","isPatch":false,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On 8/31/07, Giuseppe Bilotta <giuseppe.bilotta@gmail.com> wrote:\n> On 8/31/07, Jakub Narebski <jnareb@gmail.com> wrote:\n> > On Fri, 31 August 2007, Giuseppe Bilotta wrote:\n> > > If I understand correctly, a detached HEAD is simply a checkout in the\n> > > middle of a branch, and thus not named. So what exactly are we looking\n> > > for when we talk about supporting a detached HEAD? Would it be enough\n> > > to display HEAD in the list of heads?\n> >\n> > I think we want display HEAD in the list of heads if it is detached,\n> > and also use it as a ref marker, while only marking (with undeline or\n> > bold style) current head as such if HEAD is not detached, i.e. is\n> > symref or symlink.\n\nOk, implementation at\n\nhttp://oblomov.dnsalias.org/git?p=git.git;a=summary\n\ncomments welcome. You can see it in action here\n\nhttp://oblomov.dnsalias.org/git?p=gittest.git;a=summary\n\nIt may not be the smartest implementation, but it's what I could cook\nup with my limited git knowledge. Plus, since it's WAY past my\nbedtime, I'll have to dealy publishing my gitweb-allheads at least\nuntil tomorrow.\n\nHave fun,\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"52020","messageId":"1188557698793-git-send-email-giuseppe.bilotta@gmail.com","threadId":"9680","inReplyTo":"cb7bb73a0708301915y47ca4a05nf511889b2bb2eaec@mail.gmail.com","subject":"[PATCH 01/14] gitweb: get remotes too when getting heads list","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-31T10:54:58Z","receivedAt":"2007-08-31T10:54:58Z","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 |    5 +++--\n 1 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex b2bae1b..65953db 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2063,7 +2063,7 @@ sub git_get_heads_list {\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', 'refs/remotes'\n \t\tor return;\n \twhile (my $line = <$fd>) {\n \t\tmy %ref_item;\n@@ -2073,8 +2073,9 @@ sub git_get_heads_list {\n \t\tmy ($hash, $name, $title) = split(' ', $refinfo, 3);\n \t\tmy ($committer, $epoch, $tz) =\n \t\t\t($committerinfo =~ /^(.*) ([0-9]+) (.*)$/);\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.2.5\n"},{"id":"52021","messageId":"11885577122839-git-send-email-giuseppe.bilotta@gmail.com","threadId":"9680","inReplyTo":"cb7bb73a0708301915y47ca4a05nf511889b2bb2eaec@mail.gmail.com","subject":"[PATCH 02/14] gitweb: make remote heads in heads list optional","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-31T10:55:12Z","receivedAt":"2007-08-31T10:55:12Z","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 |   28 +++++++++++++++++++++++++++-\n 1 files changed, 27 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 65953db..6514bef 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -271,6 +271,18 @@ our %feature = (\n \t'forks' => {\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@@ -336,6 +348,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@@ -2060,10 +2084,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', 'refs/remotes'\n+\t\t'refs/heads', ( $remote_heads ? 'refs/remotes' : '')\n \t\tor return;\n \twhile (my $line = <$fd>) {\n \t\tmy %ref_item;\n-- \n1.5.2.5\n"},{"id":"52022","messageId":"11885577231448-git-send-email-giuseppe.bilotta@gmail.com","threadId":"9680","inReplyTo":"cb7bb73a0708301915y47ca4a05nf511889b2bb2eaec@mail.gmail.com","subject":"[PATCH 03/14] gitweb: git_get_heads_list now accepts an optional list of refs.","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-31T10:55:23Z","receivedAt":"2007-08-31T10:55:23Z","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 refs/dir1, refs/dir2 etc.\nDefaults to ('heads') or ('heads', 'remotes') depending 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 6514bef..4b27352 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2081,15 +2081,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.2.5\n"},{"id":"52023","messageId":"11885577311796-git-send-email-giuseppe.bilotta@gmail.com","threadId":"9680","inReplyTo":"cb7bb73a0708301915y47ca4a05nf511889b2bb2eaec@mail.gmail.com","subject":"[PATCH 04/14] gitweb: separate heads and remotes list in summary view","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-31T10:55:31Z","receivedAt":"2007-08-31T10:55:31Z","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 4b27352..6aec28e 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -3804,6 +3804,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@@ -3811,7 +3812,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@@ -3874,6 +3876,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, undef, 0, 15,\n-- \n1.5.2.5\n"},{"id":"52024","messageId":"11885579922481-git-send-email-giuseppe.bilotta@gmail.com","threadId":"9680","inReplyTo":"cb7bb73a0708301915y47ca4a05nf511889b2bb2eaec@mail.gmail.com","subject":"[PATCH 05/14] gitweb: allow refs passed to git_heads_body to use a name different from the hash name","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-31T10:59:52Z","receivedAt":"2007-08-31T10:59:52Z","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 |   12 +++++++-----\n 1 files changed, 7 insertions(+), 5 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 6aec28e..c46e982 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -3657,16 +3657,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{'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{'name'}),\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{'name'})}, \"shortlog\") . \" | \" .\n-\t\t      $cgi->a({-href => href(action=>\"log\", hash=>$ref{'name'})}, \"log\") . \" | \" .\n-\t\t      $cgi->a({-href => href(action=>\"tree\", hash=>$ref{'name'}, 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.2.5\n"},{"id":"52025","messageId":"11885583243085-git-send-email-giuseppe.bilotta@gmail.com","threadId":"9680","inReplyTo":"cb7bb73a0708301915y47ca4a05nf511889b2bb2eaec@mail.gmail.com","subject":"[PATCH 06/14] gitweb: git_split_heads_body function.","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-31T11:05:24Z","receivedAt":"2007-08-31T11:05:24Z","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 determined by the leading part of the refname, and call git_heads_body() on 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 c46e982..cacb0d7 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -3640,6 +3640,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@@ -3880,7 +3911,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.2.5\n"},{"id":"52026","messageId":"11885591201440-git-send-email-giuseppe.bilotta@gmail.com","threadId":"9680","inReplyTo":"cb7bb73a0708301915y47ca4a05nf511889b2bb2eaec@mail.gmail.com","subject":"[PATCH 07/14] gitweb: use CSS to style split head lists.","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-31T11:18:38Z","receivedAt":"2007-08-31T11:18:38Z","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 split 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 1b88879..c36b20a 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 cacb0d7..dc9727e 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -3665,9 +3665,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.2.5\n"},{"id":"52027","messageId":"11885591283893-git-send-email-giuseppe.bilotta@gmail.com","threadId":"9680","inReplyTo":"11885591201440-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH 08/14] gitweb: add 'remotes' action as a synonym for git_heads()","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-31T11:18:39Z","receivedAt":"2007-08-31T11:18:39Z","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 |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex dc9727e..6dfb2f4 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -562,6 +562,7 @@ my %actions = (\n \t\"commit\" => \\&git_commit,\n \t\"forks\" => \\&git_forks,\n \t\"heads\" => \\&git_heads,\n+\t\"remotes\" => \\&git_heads,\n \t\"history\" => \\&git_history,\n \t\"log\" => \\&git_log,\n \t\"rss\" => \\&git_rss,\n-- \n1.5.2.5\n"},{"id":"52028","messageId":"11885591321597-git-send-email-giuseppe.bilotta@gmail.com","threadId":"9680","inReplyTo":"11885591283893-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH 09/14] gitweb: split heads list in head view if appropriate","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-31T11:18:40Z","receivedAt":"2007-08-31T11:18:40Z","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 |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 6dfb2f4..09d9793 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -4195,6 +4195,9 @@ sub git_heads {\n \n \tmy @headslist = git_get_heads_list();\n \tif (@headslist) {\n+\t\tmy ($remote_heads) = gitweb_check_feature('remote_heads');\n+\t\t$remote_heads ? \n+\t\tgit_split_heads_body(\\@headslist, $head) :\n \t\tgit_heads_body(\\@headslist, $head);\n \t}\n \tgit_footer_html();\n-- \n1.5.2.5\n"},{"id":"52029","messageId":"11885591542097-git-send-email-giuseppe.bilotta@gmail.com","threadId":"9680","inReplyTo":"cb7bb73a0708301915y47ca4a05nf511889b2bb2eaec@mail.gmail.com","subject":"[PATCH 10/14] gitweb: display HEAD in heads list when detached","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-31T11:19:10Z","receivedAt":"2007-08-31T11:19:10Z","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 09d9793..e743c3d 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2090,6 +2090,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.2.5\n"},{"id":"52030","messageId":"11885591601143-git-send-email-giuseppe.bilotta@gmail.com","threadId":"9680","inReplyTo":"11885591542097-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH 11/14] gitweb: git_is_head_detached() function","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-31T11:19:11Z","receivedAt":"2007-08-31T11:19:11Z","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 checking 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 e743c3d..a745434 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1416,6 +1416,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@@ -2091,11 +2098,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.2.5\n"},{"id":"52033","messageId":"11885591653402-git-send-email-giuseppe.bilotta@gmail.com","threadId":"9680","inReplyTo":"11885591601143-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH 12/14] gitweb: add HEAD to list of shortlog refs if detached","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-31T11:19:12Z","receivedAt":"2007-08-31T11:19:12Z","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 a745434..4f7b7da 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1688,6 +1688,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.2.5\n"},{"id":"52032","messageId":"1188559169764-git-send-email-giuseppe.bilotta@gmail.com","threadId":"9680","inReplyTo":"11885591653402-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH 13/14] gitweb: CSS style and refs mark for detached HEAD","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-31T11:19:13Z","receivedAt":"2007-08-31T11:19:13Z","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 c36b20a..59ca071 100644\n--- a/gitweb/gitweb.css\n+++ b/gitweb/gitweb.css\n@@ -498,6 +498,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 4f7b7da..2c8a665 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1690,7 +1690,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.2.5\n"},{"id":"52031","messageId":"11885591742917-git-send-email-giuseppe.bilotta@gmail.com","threadId":"9680","inReplyTo":"1188559169764-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH 14/14] gitweb: minor whitespace cleanups","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2007-08-31T11:19:14Z","receivedAt":"2007-08-31T11:19: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 |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 2c8a665..a767763 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2098,11 +2098,11 @@ sub git_get_heads_list {\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 @refs = map { \"refs/$_\" } @class;\n \tmy @headslist;\n \n \tif (grep { $_ eq 'heads' } @class) {\n-\t\tif (git_is_head_detached()) { ;\n+\t\tif (git_is_head_detached()) {\n \t\t\tmy %ref_item;\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@@ -2449,7 +2449,7 @@ sub git_footer_html {\n \t\tprint $cgi->a({-href => href(project=>undef, action=>\"project_index\"),\n \t\t              -class => \"rss_logo\"}, \"TXT\") . \"\\n\";\n \t}\n-\tprint \"</div>\\n\" ;\n+\tprint \"</div>\\n\";\n \n \tif (-f $site_footer) {\n \t\topen (my $fd, $site_footer);\n-- \n1.5.2.5\n"}]}