diff options
Diffstat (limited to 'merge-ort.c')
| -rw-r--r-- | merge-ort.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/merge-ort.c b/merge-ort.c index 6491070d96..6a48aea227 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -18,8 +18,8 @@ #include "merge-ort.h" #include "alloc.h" +#include "advice.h" #include "attr.h" -#include "blob.h" #include "cache-tree.h" #include "commit.h" #include "commit-reach.h" @@ -39,11 +39,10 @@ #include "path.h" #include "promisor-remote.h" #include "read-cache-ll.h" +#include "refs.h" #include "revision.h" #include "sparse-index.h" #include "strmap.h" -#include "submodule-config.h" -#include "submodule.h" #include "trace2.h" #include "tree.h" #include "unpack-trees.h" @@ -2644,7 +2643,7 @@ static void apply_directory_rename_modifications(struct merge_options *opt, oidcpy(&ci->stages[i].oid, null_oid()); } - // Now we want to focus on new_ci, so reassign ci to it + /* Now we want to focus on new_ci, so reassign ci to it. */ ci = new_ci; } @@ -4558,7 +4557,7 @@ static void print_submodule_conflict_suggestion(struct string_list *csub) { " - commit the resulting index in the superproject\n"), tmp.buf, subs.buf); - printf("%s", msg.buf); + advise_if_enabled(ADVICE_SUBMODULE_MERGE_CONFLICT, "%s", msg.buf); strbuf_release(&subs); strbuf_release(&tmp); @@ -4662,9 +4661,6 @@ void merge_switch_to_result(struct merge_options *opt, { assert(opt->priv == NULL); if (result->clean >= 0 && update_worktree_and_index) { - const char *filename; - FILE *fp; - trace2_region_enter("merge", "checkout", opt->repo); if (checkout(opt, head, result->tree)) { /* failure to function */ @@ -4690,10 +4686,17 @@ void merge_switch_to_result(struct merge_options *opt, trace2_region_leave("merge", "record_conflicted", opt->repo); trace2_region_enter("merge", "write_auto_merge", opt->repo); - filename = git_path_auto_merge(opt->repo); - fp = xfopen(filename, "w"); - fprintf(fp, "%s\n", oid_to_hex(&result->tree->object.oid)); - fclose(fp); + if (refs_update_ref(get_main_ref_store(opt->repo), "", "AUTO_MERGE", + &result->tree->object.oid, NULL, REF_NO_DEREF, + UPDATE_REFS_MSG_ON_ERR)) { + /* failure to function */ + opt->priv = NULL; + result->clean = -1; + merge_finalize(opt, result); + trace2_region_leave("merge", "write_auto_merge", + opt->repo); + return; + } trace2_region_leave("merge", "write_auto_merge", opt->repo); } if (display_update_msgs) |
