• Jeff King's avatar
    reflog-walk: always make [email protected]{0} show indexed selectors · 794151e9
    Jeff King authored
    When we are showing reflog selectors during a walk, we infer
    from context whether the user wanted to see the index in
    each selector, or the reflog date. The current rules are:
    
      1. if the user asked for an explicit date format in the
         output, show the date
    
      2. if the user asked for [email protected]{now}, show the date
    
      3. if neither is true, show the index
    
    However,  if we see "[email protected]{0}", that should be a strong clue
    that the user wants to see the counted version. In fact, it
    should be much stronger than the date format in (1). The
    user may have been setting the date format to use in another
    part of the output (e.g., in --format="%gd (%ad)", they may
    have wanted to influence the author date).
    
    This patch flips the rules to:
    
      1. if the user asked for [email protected]{0}, always show the index
    
      2. if the user asked for [email protected]{now}, always show the date
    
      3. otherwise, we have just "ref"; show them counted by
         default, but respect the presence of "--date" as a clue
         that the user wanted them date-based
    Signed-off-by: default avatarJeff King <[email protected]>
    Signed-off-by: default avatarJunio C Hamano <[email protected]>
    794151e9
reflog-walk.c 7.91 KB