Skip to content
  • Jeff King's avatar
    diff: reuse diff setup for --no-index case · 287ab28b
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    When "--no-index" is in effect (or implied by the arguments), git-diff
    jumps early to a special code path to perform that diff. This means we
    miss out on some settings like enabling --ext-diff and --textconv by
    default.
    
    Let's jump to the no-index path _after_ we've done more setup on
    rev.diffopt. Since some of the options don't affect us (e.g., items
    related to the index), let's re-order the setup into two blocks (see the
    in-code comments).
    
    Note that we also need to stop re-initializing the diffopt struct in
    diff_no_index(). This should not be necessary, as it will already have
    been initialized by cmd_diff() (and there are no other callers). That in
    turn lets us drop the "repository" argument from diff_no_index (which
    never made much sense, since the whole point is that you don't need a
    repository).
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    287ab28b