MCPcopy Index your code
hub / github.com/git/git / load_patch_target

Function load_patch_target

apply.c:3536–3561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3534#define SUBMODULE_PATCH_WITHOUT_INDEX 1
3535
3536static 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

Callers 2

load_preimageFunction · 0.85
load_currentFunction · 0.85

Calls 4

read_file_or_gitlinkFunction · 0.85
errorFunction · 0.85
has_symlink_leading_pathFunction · 0.85
read_old_dataFunction · 0.85

Tested by

no test coverage detected