-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Changing the computation of next issue index #4084
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
Comments
Good idea to be able to import issues from other system and ease the process of migration. |
Importing the issues might be a bit tricky to add. There are requests for github in #3757 #479 #1445 and I understand why this should not be part of Gitea: it opens the Pandora box and will turn out to be very tricky to maintain due to the various ways the issues are indexed on these systems. And even then, there will be people like me who are trying to merge repositories where the commits are referencing some issues stored in Redmine AND other issues stored in Gitea. I suspect I will do a lot manual tweaks in the end. Also I am not sure if this can be classified as a bug. This would be closer to an enhancement as the code is working as is now, what I propose is mostly increasing the robustness. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions. |
Do we want to include this in the 2.x.x milestone? |
I think this has been resolved? |
@lunny yes. Index numbers are currently calculated from the higher existing, so "holes" are not a problem anymore. |
Description
While looking at importing issues from Redmine, I noticed a corner case that could cause problems when the database is tempered with:
When creating a new issue, the issue number is computed with
opts.Repo.NextIssueIndex()
which returns the sum of issues and pull requests stored in therepository
table. If the numbering of issues and pull request is not continuous, this could lead to trying to create an issue with an index already existing,Would it be better to generate the new index number by using the maximum index in the
issue
table?The index column is indexed so there should not be a significant impact and would prevent any issue even if someone tempered a bit with the database. And doing it relying on the atomicity of the database could prevent the need for a MUTEX as said in the code.
The text was updated successfully, but these errors were encountered: