From: Jakub Narebski Date: Wed, 13 Oct 2010 11:35:20 +0000 (+0200) Subject: gitweb: Improve behavior for actionless path_info gitweb URLs X-Git-Tag: v1.7.4-rc0~178 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d0af3734f14410e9c297aa08bf46fdb153a25ccb;p=git.git gitweb: Improve behavior for actionless path_info gitweb URLs Eli Barzilay noticed that http://server/gitweb/project/ link goes to 'shortlog' view, while 'commit' view would be more useful, but that 'shortlog' action is more apropriate for http://server/gitweb/project/.. links. Therefore for the case when we don't have either action, or filename, or parent hash [base] in path_info-based URL, i.e. for http://server/gitweb/project/ link, instead of using 'shortlog' view we allow dispatch() subroutine to detect type of object and use appropriate action (in most case it would be either 'commit' action, or 'tag', or 'tree' for top directory). Requested-by: Eli Barzilay Signed-off-by: Jakub Narebski Tested-by: Eli Barzilay Signed-off-by: Junio C Hamano --- diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index c4d3e0846..8d7e4c5e4 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -819,8 +819,15 @@ sub evaluate_path_info { # hash_base instead. It should also be noted that hand-crafted # links having 'history' as an action and no pathname or hash # set will fail, but that happens regardless of PATH_INFO. - $input_params{'action'} ||= "shortlog"; - if (grep { $_ eq $input_params{'action'} } @wants_base) { + if (defined $parentrefname) { + # if there is parent let the default be 'shortlog' action + # (for http://git.example.com/repo.git/A..B links); if there + # is no parent, dispatch will detect type of object and set + # action appropriately if required (if action is not set) + $input_params{'action'} ||= "shortlog"; + } + if ($input_params{'action'} && + grep { $_ eq $input_params{'action'} } @wants_base) { $input_params{'hash_base'} ||= $refname; } else { $input_params{'hash'} ||= $refname;