-
-
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
restore-repo: issue comments are no longer imported #22581
Comments
Workaround for a bug in Gitea that blocks us from importing comments. This works for us, no idea whether it's the right approach, though. Tracked upstream at go-gitea#22581
Hmm... My original suggestion was to simply add a primary key to that table and IIRC correctly my code to do that was even removed from that PR and therefore I should not have been left on the commit as an author. IIRC it was later decided that the foreign reference wasn't used anywhere and it was simpler to drop the table completely. I don't know this code very well so I don't understand why and wherefore this was added. @wxiaoguang IIRC you said to remove this table? |
Now looking at #18446. ForeignReference was added as a way to keep a match between a migrated repo issue id and pull id and its original repo. The idea presumably being that it would help in future to auto add incremental migrations and federation etc. Of course the problem is whether the ForeignReference is actually helpful for that - possibly not as it may need to have the actual url for the entity that is referencing, but I'm not certain. Now I don't fully understand why the code in #21721 would break things. @drsybren could you please give clear instructions on how to reproduce your issue and report any logs? |
About why:
Actually, I think it's caused by some PRs before 18446. If I understand correctly, there was an The root problem is: the
Maybe I misunderstood something , but indeed the design really seemed misleading for me. In history, that's all correct: But #16356 introduced |
To reproduce the issue, unzip demo-repo-22581.zip, then run When visiting the repo in Gitea's web interface, you'll notice that there is one imported issue, but no comments, even though there is a corresponding file in There's nothing about this in the logs. |
Fix restore repo bug, clarify the problem of ForeignIndex #22776 |
Fix #22581 TLDR: #18446 made a mess with ForeignIndex and triggered a design flaw/bug of #16356, then a quick patch #21271 helped #18446, then the the bug was re-triggered by #21721 . Related: * #16356 * BasicIssueContext https://github.com/go-gitea/gitea/pull/16356/files#diff-7938eb670d42a5ead6b08121e16aa4537a4d716c1cf37923c70470020fb9d036R16-R27 * #18446 * If some issues were dumped without ForeignIndex, then they would be imported as ForeignIndex=0 https://github.com/go-gitea/gitea/pull/18446/files#diff-1624a3e715d8fc70edf2db1630642b7d6517f8c359cc69d58c3958b34ba4ce5eR38-R39 * #21271 * It patched the above bug (somewhat), made the issues without ForeignIndex could have the same value as LocalIndex * #21721 * It re-triggered the zero-ForeignIndex bug. ps: I am not sure whether the changes in `GetForeignIndex` are ideal (at least, now it has almost the same behavior as BasicIssueContext in #16356), it's just a quick fix. Feel free to edit on this PR directly or replace it. Co-authored-by: zeripath <[email protected]>
…2776) Fix go-gitea#22581 TLDR: go-gitea#18446 made a mess with ForeignIndex and triggered a design flaw/bug of go-gitea#16356, then a quick patch go-gitea#21271 helped go-gitea#18446, then the the bug was re-triggered by go-gitea#21721 . Related: * go-gitea#16356 * BasicIssueContext https://github.com/go-gitea/gitea/pull/16356/files#diff-7938eb670d42a5ead6b08121e16aa4537a4d716c1cf37923c70470020fb9d036R16-R27 * go-gitea#18446 * If some issues were dumped without ForeignIndex, then they would be imported as ForeignIndex=0 https://github.com/go-gitea/gitea/pull/18446/files#diff-1624a3e715d8fc70edf2db1630642b7d6517f8c359cc69d58c3958b34ba4ce5eR38-R39 * go-gitea#21271 * It patched the above bug (somewhat), made the issues without ForeignIndex could have the same value as LocalIndex * go-gitea#21721 * It re-triggered the zero-ForeignIndex bug. ps: I am not sure whether the changes in `GetForeignIndex` are ideal (at least, now it has almost the same behavior as BasicIssueContext in go-gitea#16356), it's just a quick fix. Feel free to edit on this PR directly or replace it. Co-authored-by: zeripath <[email protected]>
…22794) Backport #22776 Fix #22581 TLDR: #18446 made a mess with ForeignIndex and triggered a design flaw/bug of #16356, then a quick patch #21271 helped #18446, then the the bug was re-triggered by #21721 . Related: * #16356 * BasicIssueContext https://github.com/go-gitea/gitea/pull/16356/files#diff-7938eb670d42a5ead6b08121e16aa4537a4d716c1cf37923c70470020fb9d036R16-R27 * #18446 * If some issues were dumped without ForeignIndex, then they would be imported as ForeignIndex=0 https://github.com/go-gitea/gitea/pull/18446/files#diff-1624a3e715d8fc70edf2db1630642b7d6517f8c359cc69d58c3958b34ba4ce5eR38-R39 * #21271 * It patched the above bug (somewhat), made the issues without ForeignIndex could have the same value as LocalIndex * #21721 * It re-triggered the zero-ForeignIndex bug. ps: I am not sure whether the changes in `GetForeignIndex` are ideal (at least, now it has almost the same behavior as BasicIssueContext in #16356), it's just a quick fix. Feel free to edit on this PR directly or replace it. Co-authored-by: wxiaoguang <[email protected]>
Description
Since 71ca306 issue comments are no longer imported with
gitea restore-repo
.See
func (r *RepositoryRestorer) GetComments(...)
inservices/migrations/restore.go
, it still usescommentable.GetForeignIndex()
(link) but as far as I can see that foreign index isn't loaded any more since that commit.This patches things up for me locally, but I don't know if this is the right thing to do:
To reproduce the issue, unzip demo-repo-22581.zip, then run
gitea restore-repo -r /path/to/demo-repo-22581 --owner_name youruser --repo_name demo-repo-22581
When visiting the repo in Gitea's web interface, you'll notice that there is one imported issue, but no comments, even though there is a corresponding file in
demo-repo-22581/comment/104010.yml
.There's nothing about this in the logs.
Gitea Version
29b78bc
How are you running Gitea?
Self-built from the
main
branch.Database
PostgreSQL
The text was updated successfully, but these errors were encountered: