return 0;
}
-static void create_file(struct apply_state *state, struct patch *patch)
+static int create_file(struct apply_state *state, struct patch *patch)
{
char *path = patch->new_name;
unsigned mode = patch->new_mode;
mode = S_IFREG | 0644;
create_one_file(state, path, mode, buf, size);
- if (patch->conflicted_threeway) {
- if (add_conflicted_stages_file(state, patch))
- exit(128);
- } else {
- if (add_index_file(state, path, mode, buf, size))
- exit(128);
- }
+ if (patch->conflicted_threeway)
+ return add_conflicted_stages_file(state, patch);
+ else
+ return add_index_file(state, path, mode, buf, size);
}
/* phase zero is to remove, phase one is to create */
return;
}
if (patch->is_new > 0 || patch->is_copy) {
- if (phase == 1)
- create_file(state, patch);
+ if (phase == 1) {
+ if (create_file(state, patch))
+ exit(128);
+ }
return;
}
/*
if (remove_file(state, patch, patch->is_rename))
exit(128);
}
- if (phase == 1)
- create_file(state, patch);
+ if (phase == 1) {
+ if (create_file(state, patch))
+ exit(128);
+ }
}
static int write_out_one_reject(struct apply_state *state, struct patch *patch)