• J
    gitweb: Use feed link according to current view · 3562198b
    Jakub Narebski 提交于
    Michael G. Noll said in comments to the "Switching my code repository from
    Subversion (SVN) to git" article (http://tinyurl.com/37v67l) in his "My
    digital moleskine" blog, that one of the things he is missing in gitweb
    from SVN::Web is an RSS feed with news/information of the current view
    (including RSS feed for single file or directory).
    
    This is not exactly true, as since refactoring feed generation in af6feeb2
    (gitweb: Refactor feed generation, make output prettier, add Atom feed,
    2006-11-19), gitweb can generate feeds (RSS or Atom) for history of a
    given branch, history limited to a given directory, or history of a given
    file.  Nevertheless this required handcrafting the URL to get wanted RSS
    feed.
    
    This commit makes gitweb select feed links in the HTML header and in
    page footer depending on current view (action).  It is more elaborate,
    and I guess more correct, than simple patch adding $hash ('h')
    parameter to *all* URLs, including feed links, by Jean-Baptiste Quenot
    
      Subject: [PATCH] gitweb: Add hash parameter in feed URL when a hash
               is specified in the current request
      Message-ID: <ae63f8b50803211138y6355fd11pa64cda50a1f53011@mail.gmail.com>
    
    If $hash ('h') or $hash_base ('hb') parameter is a branch name
    (i.e. it starts with 'refs/heads/'; all generated URLs use this form
    to discriminate between tags and heads), it is used in feed URLs; if
    $file_name ('f') is defined, it is used in feed URLs.  Feed title is
    set according to the kind of web feed: it is either 'log' for generic
    feed, 'log of <branch>', 'history of <filename>' for generic history
    (using implicit or explicit HEAD, i.e. current branch) or 'history of
    <filename> on <branch>'.
    
    There are special cases: 'heads' and 'forks' views should use OPML
    providing list of available feeds; 'tags' probably also should use
    OPML; there is no web feed equivalent to 'search' view.  Currently all
    those cases fallback to (show) default feed.  Such feed link uses
    "generic" class, and is shown in slightly lighter color for
    distinction.
    
    Currently feed can have but one starting point, and does not support
    negative (exclude) commit arguments.  Therefore for now for *diff
    views it is chosen that feed follow the "to" part: to-name, to-commit
    for 'blobdiff', 'treediff' and 'commitdiff' views.
    
    Generating parameters for href() for feed link was separated
    (refactored) into get_feed_info() subroutine.
    Signed-off-by: NJakub Narebski <jnareb@gmail.com>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    3562198b
gitweb.perl 168.7 KB