summaryrefslogtreecommitdiff
path: root/merge-ort.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2020-12-13 08:04:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-12-13 22:18:20 (GMT)
commit9fefce68dc85d96781090f86c067d83f7c50b617 (patch)
tree58f380b91c6a49c4ce596f54e1083ad834e09bbd /merge-ort.c
parentbb470f4e13e90889030d48f618ded5c0961943a3 (diff)
downloadgit-9fefce68dc85d96781090f86c067d83f7c50b617.zip
git-9fefce68dc85d96781090f86c067d83f7c50b617.tar.gz
git-9fefce68dc85d96781090f86c067d83f7c50b617.tar.bz2
merge-ort: basic outline for merge_switch_to_result()
This adds a basic implementation for merge_switch_to_result(), though just in terms of a few new empty functions that will be defined in subsequent commits. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-ort.c')
-rw-r--r--merge-ort.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/merge-ort.c b/merge-ort.c
index a7b0df8..ee7fbe7 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -971,13 +971,53 @@ static void process_entries(struct merge_options *opt,
string_list_clear(&dir_metadata.offsets, 0);
}
+static int checkout(struct merge_options *opt,
+ struct tree *prev,
+ struct tree *next)
+{
+ die("Not yet implemented.");
+}
+
+static int record_conflicted_index_entries(struct merge_options *opt,
+ struct index_state *index,
+ struct strmap *paths,
+ struct strmap *conflicted)
+{
+ if (strmap_empty(conflicted))
+ return 0;
+
+ die("Not yet implemented.");
+}
+
void merge_switch_to_result(struct merge_options *opt,
struct tree *head,
struct merge_result *result,
int update_worktree_and_index,
int display_update_msgs)
{
- die("Not yet implemented");
+ assert(opt->priv == NULL);
+ if (result->clean >= 0 && update_worktree_and_index) {
+ struct merge_options_internal *opti = result->priv;
+
+ if (checkout(opt, head, result->tree)) {
+ /* failure to function */
+ result->clean = -1;
+ return;
+ }
+
+ if (record_conflicted_index_entries(opt, opt->repo->index,
+ &opti->paths,
+ &opti->conflicted)) {
+ /* failure to function */
+ result->clean = -1;
+ return;
+ }
+ }
+
+ if (display_update_msgs) {
+ /* TODO: print out CONFLICT and other informational messages. */
+ }
+
merge_finalize(opt, result);
}