Copied cherry-pick MR description can omit inferred issue reference

Summary

When creating a merge request after a cherry-pick, copying the picked merge request description can omit the inferred issue reference if the selected Default.md template contains %{closes_issue}.

Steps to reproduce

  1. Create an issue, such as issue #1.
  2. Add %{closes_issue} to .gitlab/merge_request_templates/Default.md.
  3. Merge a merge request that has a nonblank description.
  4. Cherry-pick its merge commit to an issue-prefixed branch, such as 1-backport-fix.
  5. Choose Create merge request and Copy merge request description.
  6. Target the project's default branch.

Example Project

Not applicable. The behavior is reproducible in the GitLab application.

What is the current bug behavior?

The copied description replaces the rendered template, but the inferred issue reference is omitted:

Description of the picked merge request

When automatic issue closing is enabled and the merge request targets the default branch, the missing reference prevents this description from establishing the expected closing relationship. When automatic closing is disabled, the expected Related to reference is omitted instead.

What is the expected correct behavior?

The copied description should remain authoritative and the inferred reference should be appended:

Description of the picked merge request

Closes #1

Actual automatic closure still requires automatic issue closing to be enabled and the merge request to target the project's default branch. When automatic closing is disabled, the generated reference is Related to #1.

Relevant logs and/or screenshots

No screenshot is required. A focused regression spec on canonical master reproduced:

Expected: Description of the picked merge request\n\nCloses #1
Actual:   Description of the picked merge request

Output of checks

A bounded GitLab-only public search found no obvious exact duplicate. Private report scope is unknown.

Results of GitLab environment info

Reproduced from a source checkout of canonical gitlab-org/gitlab.

Results of GitLab application Check

Not applicable to this source-level reproduction.

Possible fixes

The template records that it supplied %{closes_issue}, so GitLab suppresses the ordinary inferred-reference append. A copied cherry-pick description can later replace that rendered template while the template-derived suppression remains active.

The suppression should be cleared when an authorized, nonblank copied description actually replaces the rendered template.

Patch release information for backports

Maintainers should assess backport eligibility under the applicable maintenance policy and patch-release process.

High-severity bug remediation

Not applicable. This report makes no security or high-severity claim.

Edited by 🤖 GitLab Bot 🤖