Score:1

How to generate a patch from a merge request prior to rebase in GitLab?

cn flag

I was using this core patch by taking the GitLab URL and adding .patch:

https://git.drupalcode.org/project/drupal/-/merge_requests/2794.patch

However, on June 16, the MR was rebased from 10.1 to 11.x. I'm on 10.1, and after the rebase, the patch no longer applies.

It would have been better to download the patch locally and then apply commit it to my repo to avoid having the code change suddenly like this.

However, given that I didn't do that, what's the easiest way to generate a patch for 10.1? For example, this hash is good on 10.1.

Is there an easy way to manipulate the GitLab URL to get a working patch for a hash of an MR rather than the current head?

leymannx avatar
ne flag
I guess we need to ask GitLab. Usually people parallel to the MR upload the patch in the issue on DO to have a fixed state of the patch. This is also a thing for security. Imagine someone pushes malicious code to an MR for an years-old popular but unsolved issue and it gets recognised too late. Backdoor opened in at least some active installations that are using the GitLab patch.
id flag
AFAIK you cannot generate a diff URL like that with Gitlab at this time.
id flag
By that I mean that Gitlab cannot do a merge request diff at a given commit. But if rebased, even Git itself cannot do so because commits are removed and overwritten. Nothing is utterly impossible in this context, but a few features would have to be invented to make this happen.
ru flag
Just as a side note, you can add/re-upload the `.patch` file from the MR to the issue queue on d.o, and then hotlink the stale patch. Just mark the uploaded patch file as `do not test` to keep the queue clean (and add a comment like *stale patch file of MR xyz for composer-patches*)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.