Loading
Cover fast-forward merge when the target tip is unresolved
What does this MR do and why?
Adds a spec for fast_forward! when the target branch tip can't be resolved. rspec:undercoverage flagged the nil branch of &.sha on the prior target sha lookup on !260375 (merged). The gap predates that MR. Spec only.
Detailed context for AI agents
- Uncovered line:
app/services/merge_requests/merge_strategies/from_source_branch.rb:130,prior_target_sha = repository.commit(merge_request.target_branch_ref)&.sha. Undercover reportedbranches: 1/2(80% method coverage). The nil branch was never exercised. - Pre-existing: master has the same
&.shaon the baretarget_branchread since 13d415ea (removal ofverify_ff_merge_advancement). !260375 (merged) only changed the argument totarget_branch_ref, which put the method in the undercoverage diff. That MR carriespipeline:skip-undercoverage. - New example: stubs
repository.commit(target_branch_ref)to return nil and calls through for every othercommitcall. It asserts thatff_mergegetstarget_sha: niland that the result is recorded. - Verification: the new example passes. With
&.replaced by., it fails withNoMethodError, so it covers the nil branch. The fullfrom_source_branch_spec.rbpasses (29 examples), and rubocop is clean. - No production code change, no changelog entry.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.