{"thread":{"id":"24331","subject":"gitweb.perl suggestion","startedAt":"2010-07-08T02:38:06Z","lastAt":"2010-07-08T19:05:06Z","messageCount":5,"participants":["Eli Barzilay","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"145078","messageId":"19509.14862.368282.470934@winooski.ccs.neu.edu","threadId":"24331","inReplyTo":null,"subject":"gitweb.perl suggestion","fromName":"Eli Barzilay","fromEmail":"eli@barzilay.org","sentAt":"2010-07-08T02:38:06Z","receivedAt":"2010-07-08T02:38:06Z","isPatch":false,"sender":{"key":"eli@barzilay.org","avatar":"https://avatars.githubusercontent.com/u/185905?v=4"},"body":"Currently, if I go to\n\n  http://server/gitweb/project/<commit-sha1>\n\nI get to the shortlog page, which is not as useful as the commit\npage.  But changing this to have a default `commit' action isn't right\neither since the shortlog is more appropriate with\n\n  http://server/gitweb/project/<commit-sha1>..<other-commit-sha1>\n\nSo how about changing this:\n\n  $input_params{'action'} ||= \"shortlog\";\n\nto this:\n\n  $input_params{'action'} ||= ((defined $parentrefname) ? \"shortlog\" : \"commit\");\n\nwhich will make the first case show the commit, and the second show\nthe shortlog?\n\n-- \n          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:\n                    http://barzilay.org/                   Maze is Life!\n"},{"id":"145134","messageId":"m339vum1od.fsf@localhost.localdomain","threadId":"24331","inReplyTo":"19509.14862.368282.470934@winooski.ccs.neu.edu","subject":"Re: gitweb.perl suggestion","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-07-08T15:30:54Z","receivedAt":"2010-07-08T15:30:54Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Eli Barzilay <eli@barzilay.org> writes:\n\n> Currently, if I go to\n> \n>   http://server/gitweb/project/<commit-sha1>\n> \n> I get to the shortlog page, which is not as useful as the commit\n> page.  But changing this to have a default `commit' action isn't right\n> either since the shortlog is more appropriate with\n> \n>   http://server/gitweb/project/<commit-sha1>..<other-commit-sha1>\n> \n> So how about changing this:\n> \n>   $input_params{'action'} ||= \"shortlog\";\n> \n> to this:\n> \n>   $input_params{'action'} ||= ((defined $parentrefname) ? \"shortlog\" : \"commit\");\n> \n> which will make the first case show the commit, and the second show\n> the shortlog?\n\nThanks for noticing and informing about this issue.\n\nUnfortunately for having a fast fixup, you have hit upon larger issue.\nNamely how gitweb guesses action if there isn't provided one.\n\nCurrently there is one set of rules for evaluate_path_info (used with\npath_info URL like e.g. http://server/gitweb/project/<sha1>), and\nanother in dispath() after evaluating path info and query params (query\nparams version would be http://server/gitweb?p=project;h=<sha1>).\n\n  path_info                    | action\n  -----------------------------+--------------------------\n  object:dirname/              | tree\n  object:filename              | blob_plain\n  objectA..objectB:filename    | blobdiff_plain\n  object                       | shortlog\n  objectA..objectB             | shortlog\n\n  query params                 | action\n  -----------------------------+---------------------------\n  h=object                     | git_get_type(object)\n  hb=object;f=filename [*]     | git_get_type(object:filename)\n\n[*] There is no optimization that if it ends in '/' it is 'tree' object,\nand if it is not, then it is 'blob' (file) object.\n\nFinally if project is defined, default action is 'summary', and if it\nisn't then default action is 'project_list'.\n\n\nSo your proposed solution is good enough, but perhaps better would be to\nleave 'action' unset if there is no parent info?  Then dispatch would\nguess action, instead of doing it in less sophisticated way in\nevaluate_path_info().\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"145139","messageId":"19510.3108.337932.666012@winooski.ccs.neu.edu","threadId":"24331","inReplyTo":"m339vum1od.fsf@localhost.localdomain","subject":"Re: gitweb.perl suggestion","fromName":"Eli Barzilay","fromEmail":"eli@barzilay.org","sentAt":"2010-07-08T17:34:28Z","receivedAt":"2010-07-08T17:34:28Z","isPatch":false,"sender":{"key":"eli@barzilay.org","avatar":"https://avatars.githubusercontent.com/u/185905?v=4"},"body":"On Jul  8, Jakub Narebski wrote:\n> \n> So your proposed solution is good enough, but perhaps better would\n> be to leave 'action' unset if there is no parent info?  Then\n> dispatch would guess action, instead of doing it in less\n> sophisticated way in evaluate_path_info().\n\nAh, looking at the dispatch point, I see what you're talking about.\nBut that sounds like a larger change to the code -- since it would\nprobably lead to more default actions that get determined in dispatch\ninstead of earlier.\n\n-- \n          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:\n                    http://barzilay.org/                   Maze is Life!\n"},{"id":"145146","messageId":"201007082101.41286.jnareb@gmail.com","threadId":"24331","inReplyTo":"19510.3108.337932.666012@winooski.ccs.neu.edu","subject":"Re: gitweb.perl suggestion","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-07-08T19:01:40Z","receivedAt":"2010-07-08T19:01:40Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Eli Barzilay wrote:\n> On Jul  8, Jakub Narebski wrote:\n> > \n> > So your proposed solution is good enough, but perhaps better would\n> > be to leave 'action' unset if there is no parent info?  Then\n> > dispatch would guess action, instead of doing it in less\n> > sophisticated way in evaluate_path_info().\n> \n> Ah, looking at the dispatch point, I see what you're talking about.\n> But that sounds like a larger change to the code -- since it would\n> probably lead to more default actions that get determined in dispatch\n> instead of earlier.\n\nI don't remember if it was the real reson why http://gitweb/project/<object>\ndefaults to 'shortlog' action, but <object> can be commit, but can be also\ntag.  The 'shortlog' action makes sense for both... assuming that tag\npoints to a commit object, that is.\n\nP.S. As usual, patches welcome...\n-- \nJakub Narebski\nPoland\n"},{"id":"145148","messageId":"19510.8546.716887.192752@winooski.ccs.neu.edu","threadId":"24331","inReplyTo":"201007082101.41286.jnareb@gmail.com","subject":"Re: gitweb.perl suggestion","fromName":"Eli Barzilay","fromEmail":"eli@barzilay.org","sentAt":"2010-07-08T19:05:06Z","receivedAt":"2010-07-08T19:05:06Z","isPatch":false,"sender":{"key":"eli@barzilay.org","avatar":"https://avatars.githubusercontent.com/u/185905?v=4"},"body":"On Jul  8, Jakub Narebski wrote:\n> Eli Barzilay wrote:\n> > On Jul  8, Jakub Narebski wrote:\n> > > \n> > > So your proposed solution is good enough, but perhaps better would\n> > > be to leave 'action' unset if there is no parent info?  Then\n> > > dispatch would guess action, instead of doing it in less\n> > > sophisticated way in evaluate_path_info().\n> > \n> > Ah, looking at the dispatch point, I see what you're talking about.\n> > But that sounds like a larger change to the code -- since it would\n> > probably lead to more default actions that get determined in dispatch\n> > instead of earlier.\n> \n> I don't remember if it was the real reson why\n> http://gitweb/project/<object> defaults to 'shortlog' action, but\n> <object> can be commit, but can be also tag.  The 'shortlog' action\n> makes sense for both... assuming that tag points to a commit object,\n> that is.\n\nAh, so it has to check the type of the object anyway...\n\n\n> P.S. As usual, patches welcome...\n\n(I can turn that one-line change into a patch, but for anything more\nsubstantial I'll actually need to deal with perl...)\n\n-- \n          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:\n                    http://barzilay.org/                   Maze is Life!\n"}]}