Skip to content
  • Jeff King's avatar
    make oneline reflog dates more consistent with multiline format · cd437120
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    The multiline reflog format (e.g., as shown by "git log -g")
    will show HEAD@{<date>} rather than HEAD@{<count>} in two
    situations:
    
      1. If the user gave branch@{<date>} syntax to specify the
         reflog
    
      2. If the user gave a --date=<format> specifier
    
    It uses the "normal" date format in case 1, and the
    user-specified format in case 2.
    
    The oneline reflog format (e.g., "git reflog show" or "git
    log -g --oneline") will show the date in the same two
    circumstances. However, it _always_ shows the date as a
    relative date, and it always ignores the timezone.
    
    In case 2, it seems ridiculous to trigger the date but use a
    format totally different from what the user requested.
    
    For case 1, it is arguable that the user might want to see
    the relative date by default; however, the multiline version
    shows the normal format.
    
    This patch does three things:
    
      - refactors the "relative_date" parameter to
        show_reflog_message to be an actual date_mode enum,
        since this is how it is used (it is passed to show_date)
    
      - uses the passed date_mode parameter in the oneline
        format (making it consistent with the multiline format)
    
      - does not ignore the timezone parameter in oneline mode
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    cd437120