aboutsummaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-12-12 21:49:52 -0800
committerJunio C Hamano <gitster@pobox.com>2010-12-12 21:49:52 -0800
commit47bfb3d946288ec359bf98d06cc668a2ba12f3cb (patch)
tree2ca5f0c8e29df6578892bf5b495573bd105b6f36 /cache.h
parent6a79be3e30a8682064ef91b9598642198cddef44 (diff)
parentf4b05a4947f5f1cf3e01fb61ec5919cc28fe11f7 (diff)
downloadgit-47bfb3d946288ec359bf98d06cc668a2ba12f3cb.tar.gz
git-47bfb3d946288ec359bf98d06cc668a2ba12f3cb.tar.xz
Merge branch 'js/configurable-tab'
* js/configurable-tab: Make the tab width used for whitespace checks configurable apply --whitespace=fix: fix tab-in-indent
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/cache.h b/cache.h
index e83bc2d3b..909b1f6e9 100644
--- a/cache.h
+++ b/cache.h
@@ -1091,15 +1091,17 @@ void shift_tree_by(const unsigned char *, const unsigned char *, unsigned char *
/*
* whitespace rules.
* used by both diff and apply
+ * last two digits are tab width
*/
-#define WS_BLANK_AT_EOL 01
-#define WS_SPACE_BEFORE_TAB 02
-#define WS_INDENT_WITH_NON_TAB 04
-#define WS_CR_AT_EOL 010
-#define WS_BLANK_AT_EOF 020
-#define WS_TAB_IN_INDENT 040
+#define WS_BLANK_AT_EOL 0100
+#define WS_SPACE_BEFORE_TAB 0200
+#define WS_INDENT_WITH_NON_TAB 0400
+#define WS_CR_AT_EOL 01000
+#define WS_BLANK_AT_EOF 02000
+#define WS_TAB_IN_INDENT 04000
#define WS_TRAILING_SPACE (WS_BLANK_AT_EOL|WS_BLANK_AT_EOF)
-#define WS_DEFAULT_RULE (WS_TRAILING_SPACE|WS_SPACE_BEFORE_TAB)
+#define WS_DEFAULT_RULE (WS_TRAILING_SPACE|WS_SPACE_BEFORE_TAB|8)
+#define WS_TAB_WIDTH_MASK 077
extern unsigned whitespace_rule_cfg;
extern unsigned whitespace_rule(const char *);
extern unsigned parse_whitespace_rule(const char *);
@@ -1108,6 +1110,7 @@ extern void ws_check_emit(const char *line, int len, unsigned ws_rule, FILE *str
extern char *whitespace_error_string(unsigned ws);
extern void ws_fix_copy(struct strbuf *, const char *, int, unsigned, int *);
extern int ws_blank_line(const char *line, int len, unsigned ws_rule);
+#define ws_tab_width(rule) ((rule) & WS_TAB_WIDTH_MASK)
/* ls-files */
int report_path_error(const char *ps_matched, const char **pathspec, int prefix_offset);