The main GitLab repository (assuming it’s called ‘origin’) automatically 
maintains references to the head of the pull requests and their merge commits 
with the target branch:

refs/merge-requests/<MR-NUMBER>/head
refs/merge-requests/<MR-NUMBER>/merge

So instead of looking up the owner and the branch name for merge request 1234, 
you could simply do

git fetch origin refs/merge-requests/1234/head
git checkout -b mr-1234


You could even automate the fetch of mr branches by adding a second fetch rule 
to your configuration:

    [remote "origin"]
            url = https://gitlab.com/wireshark/wireshark.git
            fetch = +refs/heads/*:refs/remotes/origin/*
            fetch = +refs/pull/*/head:refs/remotes/origin/gh-*

With that, everything simplifies to

    git fetch origin
    git checkout mr-1234


Regards,
Matthias




From: Wireshark-dev <wireshark-dev-boun...@wireshark.org> On Behalf Of chuck c
Sent: Monday, September 27, 2021 4:08 AM
To: Developer support list for Wireshark <wireshark-dev@wireshark.org>
Subject: [Wireshark-dev] Testing Someone Else's Merge Request

https://gitlab.com/wireshark/wireshark/-/wikis/Development/SubmittingPatches#testing-someone-elses-merge-request

"If you would like to test someone else's merge request or personal repository 
branch you can do the following:
# Fetch their branch to a local branch named FETCH_HEAD.
git fetch https://gitlab.com/some-other-user/wireshark.git their-branch-name
# Create a branch from FETCH_HEAD with a more useful name.
git checkout -b other-user-branch-name FETCH_HEAD"

Then a full cmake and msbuild.

Is there a better way to try out a commit before it's merged?

Attachment: smime.p7s
Description: S/MIME cryptographic signature

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@wireshark.org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe

Reply via email to