Closed
Description
- Gitea version (or commit ref): v1.9.0
- Git version: 2.22.0
- Operating system: CentOS 7
- Database (use
[x]
):- PostgreSQL
- MySQL
- MSSQL
- SQLite
- Can you reproduce the bug at https://try.gitea.io:
- Yes (provide example URL)
- No
- Not relevant
- Log gist:
Description
The function DeleteRepository() at models/repo.go doesn't delete repo indexes.
func DeleteRepository(doer *User, uid, repoID int64) error {
}
To reproduce:
- Configure your installation to create repo indexes.
- Create a repository with default README.md and .gitignore.
- Edit README.md and add enought text so at least some of it goes into the repo_index. For instance, I've added:
int WinMain(int argc, char* argv[])
{
}
- Make sure the index was created, and run the following query in the database:
gitea=# select r.id, r.name, i.commit_sha, s.sha, s.description
from repo_indexer_status i full outer join repository r on i.repo_id = r.id
left outer join commit_status s on s.repo_id = r.id order by r.id;
id | name | commit_sha | sha | description
----+--------------------------+------------------------------------------+-----+-------------
63 | repoindextest | 6186ba7ae6d27769ac4e1da50ec25622ea13adbb | |
(1 row)
- Delete the repository from Gitea using the GUI (or API too, I guess).
- Run the query in the database again:
gitea=# select r.id, r.name, i.commit_sha, s.sha, s.description
from repo_indexer_status i full outer join repository r on i.repo_id = r.id
left outer join commit_status s on s.repo_id = r.id order by r.id;
id | name | commit_sha | sha | description
----+--------------------------+------------------------------------------+-----+-------------
| | 6186ba7ae6d27769ac4e1da50ec25622ea13adbb | |
(1 row)
As you see, there's an orphaned record in repo_indexer_status. Probably in the index itself.