Deleted commits are visible and accessible, if they are referenced in an issue
I pushed commits that had to be deleted using git reset --hard and a forced push to the remote. They aren't in the repository anymore, but still visible in the issue where they are referenced. The issue in question is this one:
To confirm the commits are gone, I checked out the repository in another directory. When trying to checkout the last commit-IDs from the issue in the repository, git tells me that the reference is not a tree, so they are definetly deleted. The deleted commits also aren't visible in the project's commit history.
It's not directly a bug, as long as this commits are not deleted in the repo they will be displayed. So an enhancement would be if gitea detects a forcepush to recheck all commits and manually mark CommitComments no longer atattched to a pull as deleted via altering the DB entry.
By the way, are the commits ever deleted from the server? It looks like there's no cleanup and the repo size is constantly growing. Can be observed via Codeberg/gitea and docs/pages where the size seems to steadily grow with every force push. And even commits that have been force-pushed 6 months ago are still not gone, so it doesn't look like git does garbage collect them?
Is git gc supposed to clean this up and working?
Isnt it normal, that if something (issue, pull/merge request, comment) references a commit, that that branch of the tree will not be deleted by garbage collection?
Well that sounds like complicated tracking as the docs/pages only shows the old commits in the dashboard of this organization AFAICT. So there must be a check that this is shown in such a history as well. But might be possible.
I still think that this behaviour is not completely desirable: It creates a lot of junk on the server storage for stuff that is frequently force-pushed and it makes it impossible to undo accident commits. I think there should be a way for repo owners or admins to delete this somewhere ...
Deleting a branch is permanent. It CANNOT be undone. Continue?