cloning source code with pull request

163 views
Skip to first unread message

Leah Stapleton

unread,
Aug 6, 2024, 5:24:41 PM8/6/24
to golang-nuts
Hello, 


If I wanted to clone the google source code with a pending pull request (such as https://go-review.googlesource.com/c/go/+/596035 ) how would I do it? 

My goal is to test the pull request.

apologies if I shouldn't have asked on this channel

Rhys Hiltner

unread,
Aug 6, 2024, 6:10:51 PM8/6/24
to golang-nuts
In the upper right corner, there's a set of three vertically stacked dots. It's right below the "Sign in" text, or your profile picture. Clicking that will open a menu of options that includes "Download patch". The keyboard shortcut "d" will get there too.

I find that the second option, "Checkout", works well. It'll give some commands like "git fetch https://go.googlesource.com/go refs/changes/35/596035/40 && git checkout FETCH_HEAD".

I think this type of question would also be in scope for golang-dev, if you prefer.

Kurtis Rader

unread,
Aug 6, 2024, 6:12:26 PM8/6/24
to Leah Stapleton, golang-nuts
In most projects you would simply clone the source for the version being patched then download and apply the fix. For source code managed by Git I like to use the `hub apply-mail -3` command to download a patch from a Git repository and apply it.

I've never done this for Go but would be mildly surprised if there was something in the standard tooling to do that with a single command. It's possible someone has written such a tool but unless you're planning on testing third-party patches on a regular basis it's unlikely to be worthwhile to find and learn to such a tool.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/a2d3434c-f9d4-4c1a-9ed2-3ec8adfda6cfn%40googlegroups.com.


--
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

Arkadiusz Drabczyk

unread,
Aug 7, 2024, 9:09:06 AM8/7/24
to Leah Stapleton, golang-nuts
On Tue, Aug 06, 2024 at 02:24:41PM -0700, Leah Stapleton wrote:
> Hello, 
>
>
> If I wanted to clone the google source code with a pending pull request (such
> as https://go-review.googlesource.com/c/go/+/596035 ) how would I do it? 
>
> My goal is to test the pull request.

$ git clone https://go.googlesource.com/go
$ cd go
$ git fetch https://go.googlesource.com/go refs/changes/35/596035/40
$ git checkout -b change-596035 FETCH_HEAD

--
Arkadiusz Drabczyk <arka...@drabczyk.org>

Roland Müller

unread,
Aug 8, 2024, 2:07:29 AM8/8/24
to Arkadiusz Drabczyk, Leah Stapleton, golang-nuts
Hello,

Shouldn't git-review plugin for git work for googlesource.com too?

After installing the tool and setting up in your local clone one can download any gerrit change locally in one step:
- git review -d #<gerrit change number>
- git review -d <full URL of change>

Uploading patches for a chnage or creating new changes would done with:
- git review

BR,
Roland

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.

Arkadiusz Drabczyk

unread,
Aug 9, 2024, 3:09:16 PM8/9/24
to Roland Müller, Leah Stapleton, golang-nuts
On Thu, Aug 08, 2024 at 09:06:22AM +0300, Roland Müller wrote:
> Hello,
>
> Shouldn't git-review plugin for git work for googlesource.com too?
>
> After installing the tool and setting up in your local clone one can download
> any gerrit change locally in one step:
> - git review -d #<gerrit change number>
> - git review -d <full URL of change>
>
> Uploading patches for a chnage or creating new changes would done with:
> - git review

possibly but I don't like using extra tools for something as simple as
fetching the changes

--
Arkadiusz Drabczyk <arka...@drabczyk.org>
Reply all
Reply to author
Forward
0 new messages