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

Function try_merge_command

merge.c:22–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22int 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
52int checkout_fast_forward(struct repository *r,
53 const struct object_id *head,

Callers 2

do_pick_commitFunction · 0.85
try_merge_strategyFunction · 0.85

Calls 8

strvec_pushfFunction · 0.85
strvec_pushFunction · 0.85
merge_argumentFunction · 0.85
run_commandFunction · 0.85
discard_indexFunction · 0.85
repo_read_indexFunction · 0.85
resolve_undo_clear_indexFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected