node-gh / gh

(DEPRECATED) GitHub CLI made with NodeJS. Use the official https://cli.github.com/ instead.
http://nodegh.io
Other
1.71k stars 217 forks source link

After sending a pull request, GH returns always to master branch, although I was sending code to another branch #332

Closed mdelapenya closed 8 years ago

mdelapenya commented 9 years ago

Imagine that I'm ee-6.2.x branch and I send a pull request to that branch, then, after sending it to the reviewer, it gets the workspace to the master branch. But I expected to be on ee-6.2.x, which was the original branch I was on before creating the pull.

As I had to type "gh pr -b ee-6.2.x -s reviewer", then I think it's actually possible to return to the original branch.

Of course, please close this issue if you don't consider it a bug :)

Thanks!!

henvic commented 9 years ago

@mdelapenya do you still have this issue? I've just tried and it seems to be working fine.

henvic at henvic-mp in ~/projects/gh-test (feature/hello●)
$ touch 1

henvic at henvic-mp in ~/projects/gh-test (feature/hello●)
$ git add 1

henvic at henvic-mp in ~/projects/gh-test (feature/hello●●)
$ git commit -m 1
[feature/hello b68b60a] 1
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 1

henvic at henvic-mp in ~/projects/gh-test (feature/hello●)
$ gh pr -b 9 -s eduardolundgren
Submitting pull request to @eduardolundgren
Counting objects: 14, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 444 bytes | 0 bytes/s, done.
Total 4 (delta 2), reused 0 (delta 0)
To git@github.com:henvic/gh-test.git
 * [new branch]      feature/hello -> feature/hello
https://github.com/eduardolundgren/gh-test/pull/70
[hook] gh pr --browser --user eduardolundgren --repo gh-test --number 70
[hook] gh jira  --assignee eduardolundgren --submittedLink https://github.com/eduardolundgren/gh-test/pull/70 --transition
warning: Skipping JIRA transition, issue number not specified.

henvic at henvic-mp in ~/projects/gh-test (feature/hello●)
mdelapenya commented 9 years ago

Hey @henvic, in fact is not working.

The use case is the following, from a reviewer point of view: Creating the branch and adding a dumb file:

~/liferay-workspace/ee/portal • git branch
* ee-6.2.x
  master
~/liferay-workspace/ee/portal • git checkout -b foo ee-6.2.x
Switched to a new branch 'foo'
~/liferay-workspace/ee/portal • touch 1
~/liferay-workspace/ee/portal • git add 1
~/liferay-workspace/ee/portal • git commit -m "1"
[foo c0291bc] 1
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 1

Sending the pull to a reviewer (me)

~/liferay-workspace/ee/portal • gh pr -b ee-6.2.x -s mdelapenya
Submitting pull request to @mdelapenya
Counting objects: 2, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 260 bytes | 0 bytes/s, done.
Total 2 (delta 1), reused 0 (delta 0)
To git@github.com:mdelapenya/liferay-portal-ee.git
 * [new branch]      foo -> foo
https://github.com/mdelapenya/liferay-portal-ee/pull/10
[hook] gh pr --browser --user mdelapenya --repo liferay-portal-ee --number 10

Everything OK. Then the reviewer (me again) fetch the pull using GH.

~/liferay-workspace/ee/portal • gh pr 10
Fetching pull request #10 into branch pr-10
From github.com:mdelapenya/liferay-portal-ee
 * [new branch]      foo        -> pr-10
Switched to branch 'pr-10'
[hook] gh pr 10 --comment 'Just started reviewing :)'
Adding comment on pull request #10
https://github.com/mdelapenya/liferay-portal-ee/pull/10

Review done! Send to another reviewer... me! :)

~/liferay-workspace/ee/portal • gh pr -b ee-6.2.x -s mdelapenya
Submitting pull request to @mdelapenya
Total 0 (delta 0), reused 0 (delta 0)
To git@github.com:mdelapenya/liferay-portal-ee.git
 * [new branch]      pr-10 -> pr-10
https://github.com/mdelapenya/liferay-portal-ee/pull/11
[hook] gh pr 10 --comment 'Pull request submitted to https://github.com/mdelapenya/liferay-portal-ee/pull/11. [See changes here...
Adding comment on pull request #10
https://github.com/mdelapenya/liferay-portal-ee/pull/10
[hook] gh pr --browser --user mdelapenya --repo liferay-portal-ee --number 11

The tricky part starts here, when removing remote pull request and local pr-10 branch

[hook] gh pr 10 --close
Closing pull request #10
Checking out files: 100% (21789/21789), done.
Switched to branch 'master'

Boom!!

Your branch is up-to-date with 'origin/master'.
https://github.com/mdelapenya/liferay-portal-ee/pull/10
~/liferay-workspace/ee/portal

As you can see, when the reviewer (which is on a branch named pr-XYZ) sends a pull to another reviewer using the tool, GH sends the workspace to master always.

For me this behavior is annoying... what do you think?

Thanks!

henvic commented 9 years ago

Thanks for describing the behavior. As soon as I'm available for more gh-related work I'll verify this.

igorbeslic commented 9 years ago

+1 same happens to me

mdelapenya commented 8 years ago

Any progress on this issue?

Thanks!

henvic commented 8 years ago

Sorry, not yet. I am going to take a look tomorrow.

But just to make sure, what version of gh are you using? The last release, right?

mdelapenya commented 8 years ago

Yeah! gh 1.12.3

henvic commented 8 years ago

@mdelapenya can you confirm the changes works as you expect it, please?

mdelapenya commented 8 years ago

Sorry for the late response @henvic, it works as expected!

Awesome!

image