| 1480 | } |
| 1481 | |
| 1482 | static int convert_to_working_tree_ca_internal(const struct conv_attrs *ca, |
| 1483 | const char *path, const char *src, |
| 1484 | size_t len, struct strbuf *dst, |
| 1485 | int normalizing, |
| 1486 | const struct checkout_metadata *meta, |
| 1487 | struct delayed_checkout *dco) |
| 1488 | { |
| 1489 | int ret = 0, ret_filter = 0; |
| 1490 | |
| 1491 | ret |= ident_to_worktree(src, len, dst, ca->ident); |
| 1492 | if (ret) { |
| 1493 | src = dst->buf; |
| 1494 | len = dst->len; |
| 1495 | } |
| 1496 | /* |
| 1497 | * CRLF conversion can be skipped if normalizing, unless there |
| 1498 | * is a smudge or process filter (even if the process filter doesn't |
| 1499 | * support smudge). The filters might expect CRLFs. |
| 1500 | */ |
| 1501 | if ((ca->drv && (ca->drv->smudge || ca->drv->process)) || !normalizing) { |
| 1502 | ret |= crlf_to_worktree(src, len, dst, ca->crlf_action); |
| 1503 | if (ret) { |
| 1504 | src = dst->buf; |
| 1505 | len = dst->len; |
| 1506 | } |
| 1507 | } |
| 1508 | |
| 1509 | ret |= encode_to_worktree(path, src, len, dst, ca->working_tree_encoding); |
| 1510 | if (ret) { |
| 1511 | src = dst->buf; |
| 1512 | len = dst->len; |
| 1513 | } |
| 1514 | |
| 1515 | ret_filter = apply_filter( |
| 1516 | path, src, len, -1, dst, ca->drv, CAP_SMUDGE, meta, dco); |
| 1517 | if (!ret_filter && ca->drv && ca->drv->required) |
| 1518 | die(_("%s: smudge filter %s failed"), path, ca->drv->name); |
| 1519 | |
| 1520 | return ret | ret_filter; |
| 1521 | } |
| 1522 | |
| 1523 | int async_convert_to_working_tree_ca(const struct conv_attrs *ca, |
| 1524 | const char *path, const char *src, |
no test coverage detected