MCPcopy Create free account
hub / github.com/git/git / create_file

Function create_file

apply.c:4671–4688  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4669}
4670
4671static int create_file(struct apply_state *state, struct patch *patch)
4672{
4673 char *path = patch->new_name;
4674 unsigned mode = patch->new_mode;
4675 unsigned long size = patch->resultsize;
4676 char *buf = patch->result;
4677
4678 if (!mode)
4679 mode = S_IFREG | 0644;
4680 if (create_one_file(state, path, mode, buf, size))
4681 return -1;
4682
4683 if (patch->conflicted_threeway)
4684 return add_conflicted_stages_file(state, patch);
4685 else if (state->check_index || (state->ita_only && patch->is_new > 0))
4686 return add_index_file(state, path, mode, buf, size);
4687 return 0;
4688}
4689
4690/* phase zero is to remove, phase one is to create */
4691static int write_out_one_result(struct apply_state *state,

Callers 1

write_out_one_resultFunction · 0.70

Calls 3

create_one_fileFunction · 0.85
add_index_fileFunction · 0.85

Tested by

no test coverage detected