| 3534 | #define SUBMODULE_PATCH_WITHOUT_INDEX 1 |
| 3535 | |
| 3536 | static int load_patch_target(struct apply_state *state, |
| 3537 | struct strbuf *buf, |
| 3538 | const struct cache_entry *ce, |
| 3539 | struct stat *st, |
| 3540 | struct patch *patch, |
| 3541 | const char *name, |
| 3542 | unsigned expected_mode) |
| 3543 | { |
| 3544 | if (state->cached || state->check_index) { |
| 3545 | if (read_file_or_gitlink(ce, buf)) |
| 3546 | return error(_("failed to read %s"), name); |
| 3547 | } else if (name) { |
| 3548 | if (S_ISGITLINK(expected_mode)) { |
| 3549 | if (ce) |
| 3550 | return read_file_or_gitlink(ce, buf); |
| 3551 | else |
| 3552 | return SUBMODULE_PATCH_WITHOUT_INDEX; |
| 3553 | } else if (has_symlink_leading_path(name, strlen(name))) { |
| 3554 | return error(_("reading from '%s' beyond a symbolic link"), name); |
| 3555 | } else { |
| 3556 | if (read_old_data(st, patch, name, buf)) |
| 3557 | return error(_("failed to read %s"), name); |
| 3558 | } |
| 3559 | } |
| 3560 | return 0; |
| 3561 | } |
| 3562 | |
| 3563 | /* |
| 3564 | * We are about to apply "patch"; populate the "image" with the |
no test coverage detected