|
24 | 24 | #define CONVERT_STAT_BITS_TXT_CRLF 0x2
|
25 | 25 | #define CONVERT_STAT_BITS_BIN 0x4
|
26 | 26 |
|
27 |
| -enum crlf_action { |
28 |
| - CRLF_UNDEFINED, |
29 |
| - CRLF_BINARY, |
30 |
| - CRLF_TEXT, |
31 |
| - CRLF_TEXT_INPUT, |
32 |
| - CRLF_TEXT_CRLF, |
33 |
| - CRLF_AUTO, |
34 |
| - CRLF_AUTO_INPUT, |
35 |
| - CRLF_AUTO_CRLF |
36 |
| -}; |
37 |
| - |
38 | 27 | struct text_stat {
|
39 | 28 | /* NUL, CR, LF and CRLF counts */
|
40 | 29 | unsigned nul, lonecr, lonelf, crlf;
|
@@ -172,7 +161,7 @@ static int text_eol_is_crlf(void)
|
172 | 161 | return 0;
|
173 | 162 | }
|
174 | 163 |
|
175 |
| -static enum eol output_eol(enum crlf_action crlf_action) |
| 164 | +static enum eol output_eol(enum convert_crlf_action crlf_action) |
176 | 165 | {
|
177 | 166 | switch (crlf_action) {
|
178 | 167 | case CRLF_BINARY:
|
@@ -246,7 +235,7 @@ static int has_crlf_in_index(const struct index_state *istate, const char *path)
|
246 | 235 | }
|
247 | 236 |
|
248 | 237 | static int will_convert_lf_to_crlf(struct text_stat *stats,
|
249 |
| - enum crlf_action crlf_action) |
| 238 | + enum convert_crlf_action crlf_action) |
250 | 239 | {
|
251 | 240 | if (output_eol(crlf_action) != EOL_CRLF)
|
252 | 241 | return 0;
|
@@ -499,7 +488,7 @@ static int encode_to_worktree(const char *path, const char *src, size_t src_len,
|
499 | 488 | static int crlf_to_git(const struct index_state *istate,
|
500 | 489 | const char *path, const char *src, size_t len,
|
501 | 490 | struct strbuf *buf,
|
502 |
| - enum crlf_action crlf_action, int conv_flags) |
| 491 | + enum convert_crlf_action crlf_action, int conv_flags) |
503 | 492 | {
|
504 | 493 | struct text_stat stats;
|
505 | 494 | char *dst;
|
@@ -585,8 +574,8 @@ static int crlf_to_git(const struct index_state *istate,
|
585 | 574 | return 1;
|
586 | 575 | }
|
587 | 576 |
|
588 |
| -static int crlf_to_worktree(const char *src, size_t len, |
589 |
| - struct strbuf *buf, enum crlf_action crlf_action) |
| 577 | +static int crlf_to_worktree(const char *src, size_t len, struct strbuf *buf, |
| 578 | + enum convert_crlf_action crlf_action) |
590 | 579 | {
|
591 | 580 | char *to_free = NULL;
|
592 | 581 | struct text_stat stats;
|
@@ -1247,7 +1236,7 @@ static const char *git_path_check_encoding(struct attr_check_item *check)
|
1247 | 1236 | return value;
|
1248 | 1237 | }
|
1249 | 1238 |
|
1250 |
| -static enum crlf_action git_path_check_crlf(struct attr_check_item *check) |
| 1239 | +static enum convert_crlf_action git_path_check_crlf(struct attr_check_item *check) |
1251 | 1240 | {
|
1252 | 1241 | const char *value = check->value;
|
1253 | 1242 |
|
@@ -1297,18 +1286,10 @@ static int git_path_check_ident(struct attr_check_item *check)
|
1297 | 1286 | return !!ATTR_TRUE(value);
|
1298 | 1287 | }
|
1299 | 1288 |
|
1300 |
| -struct conv_attrs { |
1301 |
| - struct convert_driver *drv; |
1302 |
| - enum crlf_action attr_action; /* What attr says */ |
1303 |
| - enum crlf_action crlf_action; /* When no attr is set, use core.autocrlf */ |
1304 |
| - int ident; |
1305 |
| - const char *working_tree_encoding; /* Supported encoding or default encoding if NULL */ |
1306 |
| -}; |
1307 |
| - |
1308 | 1289 | static struct attr_check *check;
|
1309 | 1290 |
|
1310 |
| -static void convert_attrs(const struct index_state *istate, |
1311 |
| - struct conv_attrs *ca, const char *path) |
| 1291 | +void convert_attrs(const struct index_state *istate, |
| 1292 | + struct conv_attrs *ca, const char *path) |
1312 | 1293 | {
|
1313 | 1294 | struct attr_check_item *ccheck = NULL;
|
1314 | 1295 |
|
|
0 commit comments