Skip to content

Commit b9d0991

Browse files
newrenchriscool
authored andcommitted
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 <[email protected]> Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bc52045 commit b9d0991

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

t/helper/test-fast-rebase.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ int cmd__fast_rebase(int argc, const char **argv)
194194
last_commit = create_commit(result.tree, commit, last_commit);
195195
}
196196

197-
merge_switch_to_result(&merge_opt, head_tree, &result, 1, !result.clean);
197+
merge_finalize(&merge_opt, &result);
198198

199199
if (result.clean < 0)
200200
exit(128);
@@ -213,9 +213,6 @@ int cmd__fast_rebase(int argc, const char **argv)
213213
}
214214
if (create_symref("HEAD", branch_name.buf, reflog_msg.buf) < 0)
215215
die(_("unable to update HEAD"));
216-
217-
prime_cache_tree(the_repository, the_repository->index,
218-
result.tree);
219216
} else {
220217
fprintf(stderr, "\nAborting: Hit a conflict.\n");
221218
strbuf_addf(&reflog_msg, "rebase progress up to %s",
@@ -228,10 +225,6 @@ int cmd__fast_rebase(int argc, const char **argv)
228225
die("Failed to update %s", argv[4]);
229226
}
230227
}
231-
if (write_locked_index(&the_index, &lock,
232-
COMMIT_LOCK | SKIP_IF_UNCHANGED))
233-
die(_("unable to write %s"), get_index_file());
234-
235228
ret = (result.clean == 0);
236229
cleanup:
237230
strbuf_release(&reflog_msg);

t/t6429-merge-sequence-rename-caching.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ test_expect_success 'caching renames does not preclude finding new ones' '
7272
git switch upstream &&
7373
7474
test-tool fast-rebase --onto HEAD upstream~1 topic &&
75+
git reset --hard topic &&
7576
#git cherry-pick upstream~1..topic
7677
7778
git ls-files >tracked-files &&
@@ -200,6 +201,7 @@ test_expect_success 'rename same file identically, then reintroduce it' '
200201
export GIT_TRACE2_PERF &&
201202
202203
test-tool fast-rebase --onto HEAD upstream~1 topic &&
204+
git reset --hard topic &&
203205
#git cherry-pick upstream~1..topic &&
204206
205207
git ls-files >tracked &&
@@ -277,6 +279,7 @@ test_expect_success 'rename same file identically, then add file to old dir' '
277279
export GIT_TRACE2_PERF &&
278280
279281
test-tool fast-rebase --onto HEAD upstream~1 topic &&
282+
git reset --hard topic &&
280283
#git cherry-pick upstream~1..topic &&
281284
282285
git ls-files >tracked &&
@@ -356,8 +359,6 @@ test_expect_success 'cached dir rename does not prevent noticing later conflict'
356359
test_must_fail test-tool fast-rebase --onto HEAD upstream~1 topic >output &&
357360
#git cherry-pick upstream..topic &&
358361
359-
grep CONFLICT..rename/rename output &&
360-
361362
grep region_enter.*diffcore_rename trace.output >calls &&
362363
test_line_count = 2 calls
363364
)
@@ -456,6 +457,7 @@ test_expect_success 'dir rename unneeded, then add new file to old dir' '
456457
export GIT_TRACE2_PERF &&
457458
458459
test-tool fast-rebase --onto HEAD upstream~1 topic &&
460+
git reset --hard topic &&
459461
#git cherry-pick upstream..topic &&
460462
461463
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
522524
export GIT_TRACE2_PERF &&
523525
524526
test-tool fast-rebase --onto HEAD upstream~1 topic &&
527+
git reset --hard topic &&
525528
#git cherry-pick upstream..topic &&
526529
527530
grep region_enter.*diffcore_rename trace.output >calls &&
@@ -624,6 +627,7 @@ test_expect_success 'caching renames only on upstream side, part 1' '
624627
export GIT_TRACE2_PERF &&
625628
626629
test-tool fast-rebase --onto HEAD upstream~1 topic &&
630+
git reset --hard topic &&
627631
#git cherry-pick upstream..topic &&
628632
629633
grep region_enter.*diffcore_rename trace.output >calls &&
@@ -682,6 +686,7 @@ test_expect_success 'caching renames only on upstream side, part 2' '
682686
export GIT_TRACE2_PERF &&
683687
684688
test-tool fast-rebase --onto HEAD upstream~1 topic &&
689+
git reset --hard topic &&
685690
#git cherry-pick upstream..topic &&
686691
687692
grep region_enter.*diffcore_rename trace.output >calls &&

0 commit comments

Comments
 (0)