t6429: remove switching aspects of fast-rebase

At the time t6429 was written, merge-ort was still under development, did not have quite as many tests, and certainly was not widely deployed. Since t6429 was exercising some codepaths just a little differently, we thought having them also test the "merge_switch_to_result()" bits of merge-ort was useful even though they weren't intrinsic to the real point of these tests. However, the value provided by doing extra testing of the "merge_switch_to_result()" bits has decreased a bit over time, and it's actively making it harder to refactor `test-tool fast-rebase` into `git replay`, which we are going to do in following commits. Dispense with these bits. Co-authored-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Nov 24, 2023 at 12:10 UTC b9d0991cc702204e14e65abf95d5fc24305e542b
2 files changed +8 -10
t/helper/test-fast-rebase.c
+1 -8
@@ -194,7 +194,7 @@ int cmd__fast_rebase(int argc, const char **argv)
194 last_commit = create_commit(result.tree, commit, last_commit);
195 }
196
197 - merge_switch_to_result(&merge_opt, head_tree, &result, 1, !result.clean);
197 + merge_finalize(&merge_opt, &result);
198
199 if (result.clean < 0)
200 exit(128);
@@ -213,9 +213,6 @@ int cmd__fast_rebase(int argc, const char **argv)
213 }
214 if (create_symref("HEAD", branch_name.buf, reflog_msg.buf) < 0)
215 die(_("unable to update HEAD"));
216 -
217 - prime_cache_tree(the_repository, the_repository->index,
218 - result.tree);
216 } else {
217 fprintf(stderr, "\nAborting: Hit a conflict.\n");
218 strbuf_addf(&reflog_msg, "rebase progress up to %s",
@@ -228,10 +225,6 @@ int cmd__fast_rebase(int argc, const char **argv)
225 die("Failed to update %s", argv[4]);
226 }
227 }
231 - if (write_locked_index(&the_index, &lock,
232 - COMMIT_LOCK | SKIP_IF_UNCHANGED))
233 - die(_("unable to write %s"), get_index_file());
234 -
228 ret = (result.clean == 0);
229 cleanup:
230 strbuf_release(&reflog_msg);
t/t6429-merge-sequence-rename-caching.sh
+7 -2
@@ -72,6 +72,7 @@ test_expect_success 'caching renames does not preclude finding new ones' '
72 git switch upstream &&
73
74 test-tool fast-rebase --onto HEAD upstream~1 topic &&
75 + git reset --hard topic &&
76 #git cherry-pick upstream~1..topic
77
78 git ls-files >tracked-files &&
@@ -200,6 +201,7 @@ test_expect_success 'rename same file identically, then reintroduce it' '
201 export GIT_TRACE2_PERF &&
202
203 test-tool fast-rebase --onto HEAD upstream~1 topic &&
204 + git reset --hard topic &&
205 #git cherry-pick upstream~1..topic &&
206
207 git ls-files >tracked &&
@@ -277,6 +279,7 @@ test_expect_success 'rename same file identically, then add file to old dir' '
279 export GIT_TRACE2_PERF &&
280
281 test-tool fast-rebase --onto HEAD upstream~1 topic &&
282 + git reset --hard topic &&
283 #git cherry-pick upstream~1..topic &&
284
285 git ls-files >tracked &&
@@ -356,8 +359,6 @@ test_expect_success 'cached dir rename does not prevent noticing later conflict'
359 test_must_fail test-tool fast-rebase --onto HEAD upstream~1 topic >output &&
360 #git cherry-pick upstream..topic &&
361
359 - grep CONFLICT..rename/rename output &&
360 -
362 grep region_enter.*diffcore_rename trace.output >calls &&
363 test_line_count = 2 calls
364 )
@@ -456,6 +457,7 @@ test_expect_success 'dir rename unneeded, then add new file to old dir' '
457 export GIT_TRACE2_PERF &&
458
459 test-tool fast-rebase --onto HEAD upstream~1 topic &&
460 + git reset --hard topic &&
461 #git cherry-pick upstream..topic &&
462
463 grep region_enter.*diffcore_rename trace.output >calls &&
@@ -522,6 +524,7 @@ test_expect_success 'dir rename unneeded, then rename existing file into old dir
524 export GIT_TRACE2_PERF &&
525
526 test-tool fast-rebase --onto HEAD upstream~1 topic &&
527 + git reset --hard topic &&
528 #git cherry-pick upstream..topic &&
529
530 grep region_enter.*diffcore_rename trace.output >calls &&
@@ -624,6 +627,7 @@ test_expect_success 'caching renames only on upstream side, part 1' '
627 export GIT_TRACE2_PERF &&
628
629 test-tool fast-rebase --onto HEAD upstream~1 topic &&
630 + git reset --hard topic &&
631 #git cherry-pick upstream..topic &&
632
633 grep region_enter.*diffcore_rename trace.output >calls &&
@@ -682,6 +686,7 @@ test_expect_success 'caching renames only on upstream side, part 2' '
686 export GIT_TRACE2_PERF &&
687
688 test-tool fast-rebase --onto HEAD upstream~1 topic &&
689 + git reset --hard topic &&
690 #git cherry-pick upstream..topic &&
691
692 grep region_enter.*diffcore_rename trace.output >calls &&