parse-options-cb: stop clamping "--abbrev=" to hash length
[git/gitster.git] / ws.h
blob5ba676c5595db59832d4cb2ae7d78adbf66f9c96
1 #ifndef WS_H
2 #define WS_H
4 struct index_state;
5 struct strbuf;
7 /*
8 * whitespace rules.
9 * used by both diff and apply
10 * last two digits are tab width
12 #define WS_BLANK_AT_EOL 0100
13 #define WS_SPACE_BEFORE_TAB 0200
14 #define WS_INDENT_WITH_NON_TAB 0400
15 #define WS_CR_AT_EOL 01000
16 #define WS_BLANK_AT_EOF 02000
17 #define WS_TAB_IN_INDENT 04000
18 #define WS_TRAILING_SPACE (WS_BLANK_AT_EOL|WS_BLANK_AT_EOF)
19 #define WS_DEFAULT_RULE (WS_TRAILING_SPACE|WS_SPACE_BEFORE_TAB|8)
20 #define WS_TAB_WIDTH_MASK 077
21 /* All WS_* -- when extended, adapt diff.c emit_symbol */
22 #define WS_RULE_MASK 07777
23 extern unsigned whitespace_rule_cfg;
24 unsigned whitespace_rule(struct index_state *, const char *);
25 unsigned parse_whitespace_rule(const char *);
26 unsigned ws_check(const char *line, int len, unsigned ws_rule);
27 void ws_check_emit(const char *line, int len, unsigned ws_rule, FILE *stream, const char *set, const char *reset, const char *ws);
28 char *whitespace_error_string(unsigned ws);
29 void ws_fix_copy(struct strbuf *, const char *, int, unsigned, int *);
30 int ws_blank_line(const char *line, int len);
31 #define ws_tab_width(rule) ((rule) & WS_TAB_WIDTH_MASK)
33 #endif /* WS_H */