diff options
Diffstat (limited to 'merge.c')
| -rw-r--r-- | merge.c | 37 |
1 files changed, 22 insertions, 15 deletions
@@ -1,13 +1,16 @@ -#include "cache.h" -#include "diff.h" -#include "diffcore.h" +#include "git-compat-util.h" +#include "gettext.h" +#include "hash.h" +#include "hex.h" #include "lockfile.h" +#include "merge.h" #include "commit.h" +#include "repository.h" #include "run-command.h" #include "resolve-undo.h" +#include "tree.h" #include "tree-walk.h" #include "unpack-trees.h" -#include "dir.h" static const char *merge_argument(struct commit *commit) { @@ -19,22 +22,22 @@ int try_merge_command(struct repository *r, const char **xopts, struct commit_list *common, const char *head_arg, struct commit_list *remotes) { - struct strvec args = STRVEC_INIT; + struct child_process cmd = CHILD_PROCESS_INIT; int i, ret; struct commit_list *j; - strvec_pushf(&args, "merge-%s", strategy); + strvec_pushf(&cmd.args, "merge-%s", strategy); for (i = 0; i < xopts_nr; i++) - strvec_pushf(&args, "--%s", xopts[i]); + strvec_pushf(&cmd.args, "--%s", xopts[i]); for (j = common; j; j = j->next) - strvec_push(&args, merge_argument(j->item)); - strvec_push(&args, "--"); - strvec_push(&args, head_arg); + strvec_push(&cmd.args, merge_argument(j->item)); + strvec_push(&cmd.args, "--"); + strvec_push(&cmd.args, head_arg); for (j = remotes; j; j = j->next) - strvec_push(&args, merge_argument(j->item)); + strvec_push(&cmd.args, merge_argument(j->item)); - ret = run_command_v_opt(args.v, RUN_GIT_CMD); - strvec_clear(&args); + cmd.git_cmd = 1; + ret = run_command(&cmd); discard_index(r->index); if (repo_read_index(r) < 0) @@ -74,8 +77,12 @@ int checkout_fast_forward(struct repository *r, return -1; } for (i = 0; i < nr_trees; i++) { - parse_tree(trees[i]); - init_tree_desc(t+i, trees[i]->buffer, trees[i]->size); + if (parse_tree(trees[i]) < 0) { + rollback_lock_file(&lock_file); + return -1; + } + init_tree_desc(t+i, &trees[i]->object.oid, + trees[i]->buffer, trees[i]->size); } memset(&opts, 0, sizeof(opts)); |
