Thread (2 messages) flat view 2 messages, 1 author, 2016-06-15

[RFC 0/1] diff --check for indent-with-spaces style

From: Chris Webb <hidden>
Date: 2016-06-15 22:48:30

I've been preparing some patches against a project (qemu) which has an indent
style of only spaces, i.e. tabs forbidden. I usually use diff --check to make
sure I catch stray spaces when I'm working on tab-indented code, and although
core.whitespace can be set to indent-with-non-tab to enforce the use of tabs,
there's no corresponding 'indent-with-tab' rule to forbid them. The asymmetry
bothered me, so I've added support for this to ws.c in the following small
patch.

Would this rule be more clearly described as indent-with-non-space instead?

For completeness, I'd also like to support core.whitespace = indent-with-tab
in git apply --whitespace=fix (although I don't use this myself). It's trivial
to expand the tabs in ws_fix_copy(), but this would violate the assumption in
the calling code that whitespace cleanup doesn't result in a dst string longer
than src. I think the only sane way I can deal with this correctly is to
properly replumb ws_fix_copy() and its callers to use a strbuf instead of a
char *dst?

 cache.h |    1 +
 ws.c    |   26 ++++++++++++++++++++------
 2 files changed, 21 insertions(+), 6 deletions(-)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help