Wireshark-dev: Re: [Wireshark-dev] Testing Someone Else's Merge Request

From: chuck c <bubbasnmp@xxxxxxxxx>
Date: Mon, 27 Sep 2021 09:06:17 -0500
Thanks!

I broke the WSDG rule "Unless you know exactly what you are doing, you should strictly follow the recommendations below." and modified my git flow.
Since gitlab mirrors my fork in the background, there is just a "downstream" (my fork) that I pull and push against.
It doesn't look like non-merged commits are mirrored over to the fork.

I'll look at adding "upstream" back as a remote for testing commits.

Thanks for your help
chuck




On Mon, Sep 27, 2021 at 1:47 AM Dr. Matthias St. Pierre <Matthias.St.Pierre@xxxxxxxxx> wrote:

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-bounces@xxxxxxxxxxxxx> On Behalf Of chuck c
Sent: Monday, September 27, 2021 4:08 AM
To: Developer support list for Wireshark <wireshark-dev@xxxxxxxxxxxxx>
Subject: [Wireshark-dev] Testing Someone Else's 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?

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