merge-ort: remove code obsoleted by other changes

Commit 66b209b86a ("merge-ort: implement CE_SKIP_WORKTREE handling with conflicted entries", 2021-03-20) added some code for merge-ort to handle conflicted and skip_worktree entries in general. Included in this was an ugly hack for dealing with present-despite-skipped entries and a testcase (t6428.2) specific to that hack, since at that time users could accidentally get files into that state when using a sparse checkout. However, with the merging of 82386b4496 ("Merge branch 'en/present-despite-skipped'", 2022-03-09), that class of problems was addressed globally and in a much cleaner way. As such, the present-despite-skipped hack in merge-ort is no longer needed and can simply be removed. No additional testcase is needed here; t6428.2 was written to test the necessary functionality and is being kept. The fact that this test continues to pass despite the code being removed shows that the extra code is no longer necessary. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Aug 19, 2022 at 04:45 UTC ff033db7a8afbed5d2ba407ebd929e6898637194
1 file changed +2 -20
merge-ort.c
+2 -20
@@ -491,7 +491,6 @@ enum conflict_and_info_types {
491 CONFLICT_FILE_DIRECTORY,
492 CONFLICT_DISTINCT_MODES,
493 CONFLICT_MODIFY_DELETE,
494 - CONFLICT_PRESENT_DESPITE_SKIPPED,
494
495 /* Regular rename */
496 CONFLICT_RENAME_RENAME, /* same file renamed differently */
@@ -536,8 +535,6 @@ static const char *type_short_descriptions[] = {
535 [CONFLICT_FILE_DIRECTORY] = "CONFLICT (file/directory)",
536 [CONFLICT_DISTINCT_MODES] = "CONFLICT (distinct modes)",
537 [CONFLICT_MODIFY_DELETE] = "CONFLICT (modify/delete)",
539 - [CONFLICT_PRESENT_DESPITE_SKIPPED] =
540 - "CONFLICT (upgrade your version of git)",
538
539 /*** Regular rename ***/
540 [CONFLICT_RENAME_RENAME] = "CONFLICT (rename/rename)",
@@ -748,8 +745,7 @@ static void path_msg(struct merge_options *opt,
745 /* Sanity checks */
746 assert(omittable_hint ==
747 !starts_with(type_short_descriptions[type], "CONFLICT") ||
751 - type == CONFLICT_DIR_RENAME_SUGGESTED ||
752 - type == CONFLICT_PRESENT_DESPITE_SKIPPED);
748 + type == CONFLICT_DIR_RENAME_SUGGESTED);
749 if (opt->record_conflict_msgs_as_headers && omittable_hint)
750 return; /* Do not record mere hints in headers */
751 if (opt->priv->call_depth && opt->verbosity < 5)
@@ -4377,22 +4373,8 @@ static int record_conflicted_index_entries(struct merge_options *opt)
4373 * the CE_SKIP_WORKTREE bit and manually write those
4374 * files to the working disk here.
4375 */
4380 - if (ce_skip_worktree(ce)) {
4381 - struct stat st;
4382 -
4383 - if (!lstat(path, &st)) {
4384 - char *new_name = unique_path(opt,
4385 - path,
4386 - "cruft");
4387 -
4388 - path_msg(opt, CONFLICT_PRESENT_DESPITE_SKIPPED, 1,
4389 - path, NULL, NULL, NULL,
4390 - _("Note: %s not up to date and in way of checking out conflicted version; old copy renamed to %s"),
4391 - path, new_name);
4392 - errs |= rename(path, new_name);
4393 - }
4376 + if (ce_skip_worktree(ce))
4377 errs |= checkout_entry(ce, &state, NULL, NULL);
4395 - }
4378
4379 /*
4380 * Mark this cache entry for removal and instead add