Skip to content
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

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

Closed
eikendev opened this issue Jan 28, 2020 · 2 comments · Fixed by #10051
Closed

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

eikendev opened this issue Jan 28, 2020 · 2 comments · Fixed by #10051
Labels
Milestone

Comments

@eikendev
Copy link

  • 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?

@lunny lunny added the type/bug label Jan 28, 2020
@bagasme
Copy link
Contributor

bagasme commented Jan 28, 2020

@eikendev which master commit this bug had first appeared? and which stable version also?

@eikendev
Copy link
Author

I've encountered this in version 1.9.5 on the official Docker builds for Linux. Looking at the source, this issue seems to be still present.

@lafriks lafriks added this to the 1.11.0 milestone Jan 29, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants