• W
    Unify whitespace checking · c1795bb0
    Wincent Colaiuta 提交于
    This commit unifies three separate places where whitespace checking was
    performed:
    
     - the whitespace checking previously done in builtin-apply.c is
    extracted into a function in ws.c
    
     - the equivalent logic in "git diff" is removed
    
     - the emit_line_with_ws() function is also removed because that also
    rechecks the whitespace, and its functionality is rolled into ws.c
    
    The new function is called check_and_emit_line() and it does two things:
    checks a line for whitespace errors and optionally emits it. The checking
    is based on lines of content rather than patch lines (in other words, the
    caller must strip the leading "+" or "-"); this was suggested by Junio on
    the mailing list to allow for a future extension to "git show" to display
    whitespace errors in blobs.
    
    At the same time we teach it to report all classes of whitespace errors
    found for a given line rather than reporting only the first found error.
    Signed-off-by: NWincent Colaiuta <win@wincent.com>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    c1795bb0
cache.h 23.3 KB