Skip to content

Counts of tags are not decreased when deleting a repository #10038

@eikendev

Description

@eikendev
  • Gitea version (or commit ref): master

Description

Hello,

I have recently deleted one of my repositories, and browsed through the database to check if the removal was successful. I have found that the count for the tags that repository was associated with have not been decreased. Further, although the tags were only used for this single repository, the tags were still in the database.

By having a look at the code, it seems that the function removeTopicFromRepo() from /models/topic.go is never called, and hence the RepoCount remains unchanged after a repository is deleted. I believe that when deleting a repository in DeleteRepository() from /models/repo.go, the function should be called for every tag that repository is associated with.

I'd like to work on a pull request to resolve this issue, but I first wanted to confirm that this is indeed a bug. Also, I'm unsure whether to delete a tag if it has a count of 0, or to leave it in the database.

Lastly, if this was a bug, all current databases must be regarded as inconsistent. Should we reevaluate the counts for the tags?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions