ws.h: move declarations for ws.c functions from cache.h
Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren committed
Apr 22, 2023 at 20:17 UTC
641223137b6d78fa78946f09b472093a117dc04c
7 files changed
+40
-28
apply.c
+1
@@ -32,6 +32,7 @@
32
#include "entry.h"
33
#include "setup.h"
34
#include "symlinks.h"
35
+#include "ws.h"
36
#include "wrapper.h"
37
38
struct gitdiff_data {
cache.h
-26
@@ -603,32 +603,6 @@ int add_files_to_cache(const char *prefix, const struct pathspec *pathspec, int
603
/* diff.c */
604
extern int diff_auto_refresh_index;
605
606
-/*
607
- * whitespace rules.
608
- * used by both diff and apply
609
- * last two digits are tab width
610
- */
611
-#define WS_BLANK_AT_EOL 0100
612
-#define WS_SPACE_BEFORE_TAB 0200
613
-#define WS_INDENT_WITH_NON_TAB 0400
614
-#define WS_CR_AT_EOL 01000
615
-#define WS_BLANK_AT_EOF 02000
616
-#define WS_TAB_IN_INDENT 04000
617
-#define WS_TRAILING_SPACE (WS_BLANK_AT_EOL|WS_BLANK_AT_EOF)
618
-#define WS_DEFAULT_RULE (WS_TRAILING_SPACE|WS_SPACE_BEFORE_TAB|8)
619
-#define WS_TAB_WIDTH_MASK 077
620
-/* All WS_* -- when extended, adapt diff.c emit_symbol */
621
-#define WS_RULE_MASK 07777
622
-extern unsigned whitespace_rule_cfg;
623
-unsigned whitespace_rule(struct index_state *, const char *);
624
-unsigned parse_whitespace_rule(const char *);
625
-unsigned ws_check(const char *line, int len, unsigned ws_rule);
626
-void ws_check_emit(const char *line, int len, unsigned ws_rule, FILE *stream, const char *set, const char *reset, const char *ws);
627
-char *whitespace_error_string(unsigned ws);
628
-void ws_fix_copy(struct strbuf *, const char *, int, unsigned, int *);
629
-int ws_blank_line(const char *line, int len);
630
-#define ws_tab_width(rule) ((rule) & WS_TAB_WIDTH_MASK)
631
-
606
/* ls-files */
607
void overlay_tree_on_index(struct index_state *istate,
608
const char *tree_name, const char *prefix);
config.c
+1
@@ -35,6 +35,7 @@
35
#include "setup.h"
36
#include "trace2.h"
37
#include "worktree.h"
38
+#include "ws.h"
39
#include "wrapper.h"
40
#include "write-or-die.h"
41
diff.c
+1
@@ -41,6 +41,7 @@
41
#include "object-name.h"
42
#include "setup.h"
43
#include "strmap.h"
44
+#include "ws.h"
45
#include "wrapper.h"
46
47
#ifdef NO_FAST_WORKING_DIRECTORY
environment.c
-1
@@ -67,7 +67,6 @@ int read_replace_refs = 1;
67
enum eol core_eol = EOL_UNSET;
68
int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;
69
char *check_roundtrip_encoding = "SHIFT-JIS";
70
-unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
70
enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;
71
enum rebase_setup_type autorebase = AUTOREBASE_NEVER;
72
enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;
ws.c
+4
-1
@@ -3,9 +3,12 @@
3
*
4
* Copyright (c) 2007 Junio C Hamano
5
*/
6
-#include "cache.h"
6
+#include "git-compat-util.h"
7
#include "attr.h"
8
#include "strbuf.h"
9
+#include "ws.h"
10
+
11
+unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
12
13
static struct whitespace_rule {
14
const char *rule_name;
ws.h
new
+33
@@ -0,0 +1,33 @@
1
+#ifndef WS_H
2
+#define WS_H
3
+
4
+struct index_state;
5
+struct 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
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)
32
+
33
+#endif /* WS_H */