-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Redirects for renamed repos #807
Conversation
But if A -> B, but C -> A, then A will never be visit? |
@lunny Good point, there are a lot of bugs with reusing previously-used repo names. I'll work on finding a solution. |
0dc913c
to
493093b
Compare
@lunny I've added changes so that whenever a repo is created or renamed, any redirects from the new name are deleted. I believe this should fix the problem. |
models/repo_redirect.go
Outdated
func NewRepoRedirect(ownerID, repoID int64, oldRepoName, newRepoName string) error { | ||
oldRepoName = strings.ToLower(oldRepoName) | ||
newRepoName = strings.ToLower(newRepoName) | ||
if err := deleteRepoRedirect(x, ownerID, newRepoName); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like you use a database transaction to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added 😀
8239949
to
55b8a83
Compare
@@ -14,7 +14,7 @@ | |||
{{.CsrfTokenHtml}} | |||
<input type="hidden" name="action" value="update"> | |||
<div class="required field {{if .Err_RepoName}}error{{end}}"> | |||
<label for="repo_name">{{.i18n.Tr "repo.repo_name"}}<span class="text red hide" id="repo-name-change-prompt"> {{.i18n.Tr "repo.settings.change_reponame_prompt"}}</span></label> | |||
<label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove the prompt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prompt warns that "This change will affect how links relate to the repository". Once we have redirects, what the prompt says will no longer be true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
Otherwise LGTM |
If I remember correcly, the way github does it is to redirect for X period of time, during that time no new repo can be created with that name. Sounds good? |
@bkcsoft Github lets you create a new repo with the old name immediately; I just checked. Perhaps it used to be as you described, but not anymore? I also don't know about whether Github redirects expire. I haven't found any sources that explicitly say one way or another, and I can't easily test for myself 😄 |
conflicted |
1f2a748
to
1d63de7
Compare
LGTM |
resolved #806 |
Adds a new table (
repo_redirect
) to track what previous names should be redirected to.