Skip to content

Commit 9fefce6

Browse files
newrengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bb470f4 commit 9fefce6

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

merge-ort.c

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,13 +971,53 @@ static void process_entries(struct merge_options *opt,
971971
string_list_clear(&dir_metadata.offsets, 0);
972972
}
973973

974+
static int checkout(struct merge_options *opt,
975+
struct tree *prev,
976+
struct tree *next)
977+
{
978+
die("Not yet implemented.");
979+
}
980+
981+
static int record_conflicted_index_entries(struct merge_options *opt,
982+
struct index_state *index,
983+
struct strmap *paths,
984+
struct strmap *conflicted)
985+
{
986+
if (strmap_empty(conflicted))
987+
return 0;
988+
989+
die("Not yet implemented.");
990+
}
991+
974992
void merge_switch_to_result(struct merge_options *opt,
975993
struct tree *head,
976994
struct merge_result *result,
977995
int update_worktree_and_index,
978996
int display_update_msgs)
979997
{
980-
die("Not yet implemented");
998+
assert(opt->priv == NULL);
999+
if (result->clean >= 0 && update_worktree_and_index) {
1000+
struct merge_options_internal *opti = result->priv;
1001+
1002+
if (checkout(opt, head, result->tree)) {
1003+
/* failure to function */
1004+
result->clean = -1;
1005+
return;
1006+
}
1007+
1008+
if (record_conflicted_index_entries(opt, opt->repo->index,
1009+
&opti->paths,
1010+
&opti->conflicted)) {
1011+
/* failure to function */
1012+
result->clean = -1;
1013+
return;
1014+
}
1015+
}
1016+
1017+
if (display_update_msgs) {
1018+
/* TODO: print out CONFLICT and other informational messages. */
1019+
}
1020+
9811021
merge_finalize(opt, result);
9821022
}
9831023

0 commit comments

Comments
 (0)