]> git.ipfire.org Git - thirdparty/git.git/blame - ws.h
reftable/refname: refactor binary search over refnames
[thirdparty/git.git] / ws.h
CommitLineData
64122313
EN
1#ifndef WS_H
2#define WS_H
3
4struct index_state;
5struct strbuf;
6
7/*
8 * whitespace rules.
9 * used by both diff and apply
10 * last two digits are tab width
11 */
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
23extern unsigned whitespace_rule_cfg;
24unsigned whitespace_rule(struct index_state *, const char *);
25unsigned parse_whitespace_rule(const char *);
26unsigned ws_check(const char *line, int len, unsigned ws_rule);
27void ws_check_emit(const char *line, int len, unsigned ws_rule, FILE *stream, const char *set, const char *reset, const char *ws);
28char *whitespace_error_string(unsigned ws);
29void ws_fix_copy(struct strbuf *, const char *, int, unsigned, int *);
30int ws_blank_line(const char *line, int len);
31#define ws_tab_width(rule) ((rule) & WS_TAB_WIDTH_MASK)
32
33#endif /* WS_H */