Redirects for moved repos don't seem to work #467

Closed
asmeurer opened this Issue Jan 17, 2014 · 11 comments

Comments

Projects
None yet
4 participants

I have a repo that was moved, and I can't create a pull request to it. I have a branch pushed to origin (which is pointing to the old github name). If I try hub pull-request -b newname:master, I get:

Error creating pull request: Unprocessable Entity (HTTP 422)
Missing field: "head_sha"
Missing field: "base_sha"
No commits between newname:master and oldname:branch

If I try hub pull-request -b oldname:master, I get

Error creating pull request: Not Found (HTTP 404)
Are you sure that github.com/pydata/conda exists?

Obviously I can just do a git remote set-url origin to fix this, but ideally it would just work.

Member

mislav commented Jan 18, 2014

Yes, GitHub does redirects for the old name for web traffic and git traffic, but unfortunately not doing the same in the API layer when opening a new pull request.

How about if you do:

git pull-request -h oldname:branch
Member

mislav commented Jan 18, 2014

Err, I meant:

git pull-request -h newname:branch

I'm curios whether this would work for you. Of course, I don't intend this to be a fix. As you said, ideally it should Just Work™ as if by magic.

I'll try that the next time I do a pull request.

No that doesn't seem to work. And anyway I don't always push the branch up to origin. Usually it's to my fork.

Member

mislav commented Jan 20, 2014

Oh, I didn't know you were pushing to your fork. If your personal branch was correctly detected (was it?) then the -h option doesn't help anything.

I will look into this.

@mislav mislav added the bug label Feb 11, 2014

Member

mislav commented Oct 9, 2015

@IonicaBizau That should be the cause, although I still haven't tested properly how hub behaves around that. We don't have any automated tests for following redirects yet.

@mislav mislav added this to the v2.2.2 bugfix release milestone Oct 9, 2015

@mislav This issue is not so critical as I thought first, since the pull request content is saved. I changed the repository remote url and hub pull-request again, and my content I wrote was already there. Nice work here! 👍

mislav added a commit that referenced this issue Aug 9, 2016

Resolve owner name in PR `head` specification in case of redirects
When the repo that hosts the `head` for the PR is moved to another
owner, the `owner:branch` specification will be wrong and the GitHub API
will return HTTP 422.

This resolves the latest owner/name pair for head repo so that the value
is never stale when submitting new PR to be created.

Fixes #467

@mislav mislav closed this in 25a4dd0 Aug 10, 2016

So there's an issue with redirects in that they pretend to be what you asked for instead of what they are.

If I do hub clone krainboltgreene/blankgem I get a repository that is called blankgem, has a remote of blankgem, but the repository is krainboltgreene/blankgem.gem.

This falls apart as soon as github changes their redirect rules.

Member

mislav commented Aug 22, 2016

@krainboltgreene:

$ hub clone krainboltgreene/blankgem
Cloning into 'blankgem.gem'...

$ cd blankgem.gem/
$ git remote -v
origin  https://github.com/krainboltgreene/blankgem.gem.git (fetch)
origin  https://github.com/krainboltgreene/blankgem.gem.git (push)

I must have an outdated version, because that's not what happened locally.
I'll see about updating, thanks Mislav!

On Mon, Aug 22, 2016 at 1:58 AM, Mislav Marohnić notifications@github.com
wrote:

@krainboltgreene https://github.com/krainboltgreene:

$ hub clone krainboltgreene/blankgem
Cloning into 'blankgem.gem'...

$ cd blankgem.gem/
$ git remote -v
origin https://github.com/krainboltgreene/blankgem.gem.git (fetch)
origin https://github.com/krainboltgreene/blankgem.gem.git (push)


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#467 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAUb2e7haMo8F7ubVhnmAfQHL1NK1mF0ks5qiWSbgaJpZM4BaqmA
.

Kurtis Rainbolt-Greene, Software Developer
Founder of Difference Engineers

2985 San Marino St.
Los Angeles, CA 90006
202-643-2263

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment