Skip to content

Option to rewrite commit messages to include merge request links

Problem to solve

In order to find more context around a particular commit, going back to the merge request where the commit was discussed and revised can be very helpful. This is possible today with MRs using actual merge commits (rather than rebase), and through the web UI. It would be nice to extend this to the commit message for rebased commits.

Further details

When using an actual-merge merge request strategy, this is immediately obvious since the commit's merge parent includes a link back to the MR. But when using a rebase strategy, there is no merge commit to provide easy navigation back to the merge request.

gitlab-ce#2383 helps when doing archaeology through the web interface: when you navigate to the commit through the GitLab web UI, you can easily see a link back to the MR. However, it could be even better to have this as part of the Git commit text itself: rewrite the commit message for rebased commits to include a tag with a full URL to the merge request.

Original request

This is implemented in Patchwork, which attempts to derive meaning and sense from patches sent via email. See this example commit from the drm-tip kernel tree on freedesktop.org, which makes heavy use of all sorts of tags, including one which leads to the submission and discussion of the patch on the mailing list:

drm/i915: Remove bogus NV12 PLANE_COLOR_CTL setup

We already handle the color encoding mode properly. Remove the broken
NV12 special case.

Cc: Vidya Srinivas <vidya.srinivas@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Fixes: 8ed30ab6aced ("drm/i915: Enable YUV to RGB for Gen10 in Plane Ctrl Reg")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180521185613.5097-1-ville.syrjala@linux.intel.com
Reviewed-By: Vidya Srinivas <vidya.srinivas@intel.com>
(cherry picked from commit 012d79e6a33f095c293fe2a02b2b3b26d8c6402c)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Proposal

When merging using the fast forward merge strategy, rewrite all the commits to include Merge Request: meta data:

Improve packfile reuse

Merge-request: https://gitlab.com/gitlab-org/example/merge-request/123

This means the using Git blame will directly point the user to the merge request that added the change.

What does success look like, and how can we measure that?

Links / references

Edited by 🤖 GitLab Bot 🤖