Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto Migrate redirected repos #240

Closed
schneems opened this issue Mar 31, 2014 · 8 comments
Closed

Auto Migrate redirected repos #240

schneems opened this issue Mar 31, 2014 · 8 comments

Comments

@schneems
Copy link
Member

When a repo moves, move the users:

http://www.codetriage.com/defunkt/resque =>
http://www.codetriage.com/resque/resque

Maybe give a "migrate" this repo button of some kind where it puts your request in a manual queue or opens a github issue or something.

I could have sworn this was an open issue, but I cannot find it ATM.

@prathamesh-sonpatki
Copy link
Member

How to detect if a repo is moved or not?

Does github gives the indication in the response?

@prathamesh-sonpatki
Copy link
Member

I think the open issue is #228

@O-I
Copy link
Contributor

O-I commented Feb 17, 2015

I looked into this recently and with the help of Github support found two ways of doing this:

(1) The non-API 'hacky' route (guess which one of us came up with this idea 😄)

Although the API doesn't redirect on repository or user, github.com does. For example, 6to5/6to5 was recently renamed to babel/babel. Running curl -I https://api.github.com/repos/6to5/6to5 returns a 404. However, running curl -I https://github.com/6to5/6to5 returns a 301 with a Location field that points to the new location.

So, one alternative is to rescue GitHubBub::RequestError with a HEAD request to github.com, grab the new Location, massage that into an API request to the renamed repo, and update everything accordingly.

I think this would be a viable solution if there were no way to do this through the API, but Ivan from Github support showed me what may be a better alternative.

(2) The API route less travelled

All repositories and users have numerical IDs that uniquely identify them — we've just had no reason to store them...until maybe now. If we were to store them, then you could use that to ensure you get the same repository regardless of what it is named.

Take babel/babel again whose repo ID is 24560307. Knowing this, curl -i https://api.github.com/repositories/24560307 will always give us that repo even if it were renamed to Isomorphic/MonadicArrow tomorrow. Only if it were deleted (or maybe if it went private) would you run into problems.

You could use this same idea to solve the name switching bug mentioned in issue #301, too, using a call to https://api.github.com/user/:id.

Anyway, let me know your thoughts when you have time. I'd love to take a crack at solving this.

Cheers,
O-I

@prathamesh-sonpatki
Copy link
Member

@O-I Awesome work. 👍 I think second approach is best.

@O-I
Copy link
Contributor

O-I commented Feb 17, 2015

OK. I'll look into going that route then.

@PragTob
Copy link

PragTob commented Mar 23, 2019

👋

Is there any update or workaround for this? I wouldn't wanna introduce duplication but I just moved PragTob/benchee to bencheeorg/benchee and would like to know how to best proceed :D

@schneems
Copy link
Member Author

schneems commented Oct 9, 2022

Still needed

@hbontempo-br
Copy link
Contributor

Fixed on #1722
Can we close this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants