git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Chris Webb <chris@arachsys.com>
Date
Mar 27, 2010, 14:08 UTC
Message-ID
<1269698881-26443-1-git-send-email-chris@arachsys.com>

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(-)
Next: Chris Webb
Message 1 of 6 in “[RFC 0/1] diff --check for indent-with-spaces style”
  1. Chris WebbMar 27, 2010
  2. 1/1 Add new indent-with-tab whitespace checkChris Webb, Mar 27, 2010
  3. Junio C HamanoMar 31, 2010
  4. Re* [RFC 1/1] Add new indent-with-tab whitespace checkJunio C Hamano, Apr 1, 2010
  5. Junio C HamanoApr 1, 2010
  6. Chris WebbApr 2, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.