diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-11-24 12:47:27 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-11-24 12:47:27 -0800 |
commit | 4713fd9b5d472f94fc6f821ae8581d27da4e8094 (patch) | |
tree | e26fcc988f6d9bf9aa19e988e134a4adc67d6c28 /ws.c | |
parent | Merge branch 'jm/mailmap' into maint (diff) | |
parent | diff: handle lines containing only whitespace and tabs better (diff) | |
download | tgif-4713fd9b5d472f94fc6f821ae8581d27da4e8094.tar.xz |
Merge branch 'kb/maint-diff-ws-check' into maint
* kb/maint-diff-ws-check:
diff: handle lines containing only whitespace and tabs better
test-lib: extend test_decode_color to handle more color codes
Diffstat (limited to 'ws.c')
-rw-r--r-- | ws.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -174,8 +174,11 @@ static unsigned ws_check_emit_1(const char *line, int len, unsigned ws_rule, } } + if (trailing_whitespace == -1) + trailing_whitespace = len; + /* Check indentation */ - for (i = 0; i < len; i++) { + for (i = 0; i < trailing_whitespace; i++) { if (line[i] == ' ') continue; if (line[i] != '\t') @@ -218,8 +221,6 @@ static unsigned ws_check_emit_1(const char *line, int len, unsigned ws_rule, * Now the rest of the line starts at "written". * The non-highlighted part ends at "trailing_whitespace". */ - if (trailing_whitespace == -1) - trailing_whitespace = len; /* Emit non-highlighted (middle) segment. */ if (trailing_whitespace - written > 0) { |