| 20 | } |
| 21 | |
| 22 | int try_merge_command(struct repository *r, |
| 23 | const char *strategy, size_t xopts_nr, |
| 24 | const char **xopts, struct commit_list *common, |
| 25 | const char *head_arg, struct commit_list *remotes) |
| 26 | { |
| 27 | struct child_process cmd = CHILD_PROCESS_INIT; |
| 28 | int ret; |
| 29 | struct commit_list *j; |
| 30 | |
| 31 | strvec_pushf(&cmd.args, "merge-%s", strategy); |
| 32 | for (size_t i = 0; i < xopts_nr; i++) |
| 33 | strvec_pushf(&cmd.args, "--%s", xopts[i]); |
| 34 | for (j = common; j; j = j->next) |
| 35 | strvec_push(&cmd.args, merge_argument(j->item)); |
| 36 | strvec_push(&cmd.args, "--"); |
| 37 | strvec_push(&cmd.args, head_arg); |
| 38 | for (j = remotes; j; j = j->next) |
| 39 | strvec_push(&cmd.args, merge_argument(j->item)); |
| 40 | |
| 41 | cmd.git_cmd = 1; |
| 42 | ret = run_command(&cmd); |
| 43 | |
| 44 | discard_index(r->index); |
| 45 | if (repo_read_index(r) < 0) |
| 46 | die(_("failed to read the cache")); |
| 47 | resolve_undo_clear_index(r->index); |
| 48 | |
| 49 | return ret; |
| 50 | } |
| 51 | |
| 52 | int checkout_fast_forward(struct repository *r, |
| 53 | const struct object_id *head, |
no test coverage detected