git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Webb <chris@arachsys.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH 1/6] whitespace: we cannot "catch all errors known to git" anymore
Date: Sat, 3 Apr 2010 00:37:00 +0100	[thread overview]
Message-ID: <d2d764a408f3e9c9223c699ba77dba39ba118bac.1270250437.git.chris@arachsys.com> (raw)
In-Reply-To: <cover.1270250437.git.chris@arachsys.com>

From: Junio C Hamano <gitster@pobox.com>

Traditionally, "*.txt whitespace" in .gitattributes file has been an
instruction to catch _all_ classes of whitespace errors known to git.

This has to change, however, in order to introduce "tab-in-indent" which
is inherently incompatible with "indent-with-non-tab".  As we do not want
to break configuration of existing users, add a mechanism to allow marking
selected rules to be excluded from "all rules known to git".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Chris Webb <chris@arachsys.com>
---
 ws.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ws.c b/ws.c
index c089338..f4afcdd 100644
--- a/ws.c
+++ b/ws.c
@@ -10,7 +10,8 @@
 static struct whitespace_rule {
 	const char *rule_name;
 	unsigned rule_bits;
-	unsigned loosens_error;
+	unsigned loosens_error:1,
+		exclude_default:1;
 } whitespace_rule_names[] = {
 	{ "trailing-space", WS_TRAILING_SPACE, 0 },
 	{ "space-before-tab", WS_SPACE_BEFORE_TAB, 0 },
@@ -82,7 +83,8 @@ unsigned whitespace_rule(const char *pathname)
 			unsigned all_rule = 0;
 			int i;
 			for (i = 0; i < ARRAY_SIZE(whitespace_rule_names); i++)
-				if (!whitespace_rule_names[i].loosens_error)
+				if (!whitespace_rule_names[i].loosens_error &&
+				    !whitespace_rule_names[i].exclude_default)
 					all_rule |= whitespace_rule_names[i].rule_bits;
 			return all_rule;
 		} else if (ATTR_FALSE(value)) {
-- 
1.7.0.3

  reply	other threads:[~2010-04-02 23:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-02 23:36 [PATCH 0/6] Add tab-in-indent whitespace rule Chris Webb
2010-04-02 23:37 ` Chris Webb [this message]
2010-04-02 23:37 ` [PATCH 2/6] whitespace: add tab-in-indent error class Chris Webb
2010-04-03 10:02   ` Martin Mares
2010-04-02 23:37 ` [PATCH 3/6] whitespace: tests for git-diff --check with " Chris Webb
2010-04-02 23:37 ` [PATCH 4/6] whitespace: replumb ws_fix_copy to take a strbuf *dst instead of char *dst Chris Webb
2010-04-02 23:37 ` [PATCH 5/6] whitespace: add tab-in-indent support for --whitespace=fix Chris Webb
2010-04-02 23:37 ` [PATCH 6/6] whitespace: tests for git-apply --whitespace=fix with tab-in-indent Chris Webb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d2d764a408f3e9c9223c699ba77dba39ba118bac.1270250437.git.chris@arachsys.com \
    --to=chris@arachsys.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).