Skip to content
  • Martin Ågren's avatar
    range-diff: always pass at least minimal diff options · ac0edf1f
    Martin Ågren authored and Junio C Hamano's avatar Junio C Hamano committed
    Commit d8981c3f ("format-patch: do not let its diff-options affect
    --range-diff", 2018-11-30) taught `show_range_diff()` to accept a
    NULL-pointer as an indication that it should use its own "reasonable
    default". That fixed a regression from a5170794 ("Merge branch
    'ab/range-diff-no-patch'", 2018-11-18), but unfortunately it introduced
    a regression of its own.
    
    In particular, it means we forget the `file` member of the diff options,
    so rather than placing a range-diff in the cover-letter, we write it to
    stdout. In order to fix this, rewrite the two callers adjusted by
    d8981c3f
    
     to instead create a "dummy" set of diff options where they
    only fill in the fields we absolutely require, such as output file and
    color.
    
    Modify and extend the existing tests to try and verify that the right
    contents end up in the right place.
    
    Don't revert `show_range_diff()`, i.e., let it keep accepting NULL.
    Rather than removing what is dead code and figuring out it isn't
    actually dead and we've broken 2.20, just leave it for now.
    
    [es: retain diff coloring when going to stdout]
    
    Signed-off-by: default avatarMartin Ågren <martin.agren@gmail.com>
    Signed-off-by: default avatarEric Sunshine <sunshine@sunshineco.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    ac0edf1f