Description
- Gitea version (or commit ref): Gitea version 1.15.0 built with GNU Make 4.3, go1.16.7 : bindata, timetzdata, sqlite, sqlite_unlock_notify
- Git version:git version 2.30.2
- Operating system: docker
- Database (use
[x]
):- PostgreSQL
- MySQL
- MSSQL
- SQLite
- Can you reproduce the bug at https://try.gitea.io:
- Yes (provide example URL)
- No (the problem is about code indexer so I can't do it there)
- Log gist:
I set logo level to INFO in app.ini
Description
I'm trying to build a gitea with Code Search feature. And I hope it will immediately refresh index after any updates.
I choose elastic search as the engine and in most cases it works well. But when I migrated a repository from Github and tried using Code Search feature on the UI to find a line from that repository, it did not return any output. And in log it seems like that gitea didn't report to elastic search after migrating.
I have to manually commit something new to the new repo to trigger report to elastic search, or delete the old elastic search topic and create a new index.
I've found a related issue: #16152, but my search engine is different so I still post a new issue.
Because the original log does not provide enough info for me, I add a few log.Info codes with "zyx test" as prefix, and tactically it won't affect the original progress.
the log
In MigrateRepositoryGitData() , gitea has already set repo.IsEmpty to false(means that the repo in Github is not empty). But when doing NotifyMigrateRepository(), gitea create a new repo, so it still thinks the repo is empty and won't report to elastic search.
So my question is, is there a special reason for gitea to consider new migrated repo as empty? If so, it seems to me that NotifyMigrateRepository() shouldn't check repo.IsEmpty field when reporting to code search engine.
relevant code NotifyMigrateRepository(with my log codes)
Thanks for reading my question, look forward to your kind reply~