| 1429 | } |
| 1430 | |
| 1431 | int convert_to_git(struct index_state *istate, |
| 1432 | const char *path, const char *src, size_t len, |
| 1433 | struct strbuf *dst, int conv_flags) |
| 1434 | { |
| 1435 | int ret = 0; |
| 1436 | struct conv_attrs ca; |
| 1437 | |
| 1438 | convert_attrs(istate, &ca, path); |
| 1439 | |
| 1440 | ret |= apply_filter(path, src, len, -1, dst, ca.drv, CAP_CLEAN, NULL, NULL); |
| 1441 | if (!ret && ca.drv && ca.drv->required) |
| 1442 | die(_("%s: clean filter '%s' failed"), path, ca.drv->name); |
| 1443 | |
| 1444 | if (ret && dst) { |
| 1445 | src = dst->buf; |
| 1446 | len = dst->len; |
| 1447 | } |
| 1448 | |
| 1449 | ret |= encode_to_git(path, src, len, dst, ca.working_tree_encoding, conv_flags); |
| 1450 | if (ret && dst) { |
| 1451 | src = dst->buf; |
| 1452 | len = dst->len; |
| 1453 | } |
| 1454 | |
| 1455 | if (!(conv_flags & CONV_EOL_KEEP_CRLF)) { |
| 1456 | ret |= crlf_to_git(istate, path, src, len, dst, ca.crlf_action, conv_flags); |
| 1457 | if (ret && dst) { |
| 1458 | src = dst->buf; |
| 1459 | len = dst->len; |
| 1460 | } |
| 1461 | } |
| 1462 | return ret | ident_to_git(src, len, dst, ca.ident); |
| 1463 | } |
| 1464 | |
| 1465 | void convert_to_git_filter_fd(struct index_state *istate, |
| 1466 | const char *path, int fd, struct strbuf *dst, |
no test coverage detected