Defect #9897
openGit: revisions and branches deleted in Git repository are shown in redmine
0%
Description
When using Git repository for the project I've noticed that revisions and branches that were deleted from the repository itself are still shown in Redmine repository browser.
Most likely the problem is in Redmine revision cache cause once fetched revisions remain there even after they were deleted in repository.
Steps to reproduce:
1) create branch in Git, make several commits
2) push branch to bare repository that is connected to Redmine
3) make sure that branch is shown in repo browser in Redmine
4) delete branch from bare repository
5) branch is still shown in Redmine :(
Updated by Slawomir CALUCH almost 13 years ago
This problem was affecting previous versions as fas as I remember.
The only way to fix the content of the redmine repo is to delete the repository and re-add it.
This defect seems to be clearly related to feature #1273.
Updated by Pierre-Luc Samuel almost 13 years ago
I don't know if redmine uses git fetch, but a git fetch cmd would use "--prune" to remove branches that were deleted in the repository. Of course, if redmine keeps a cache of the repo, that won't clean it's internal cache...
Updated by Rafael Ascensao over 12 years ago
Also have this problem. Had do delete and re-add to fix.
Updated by Jesús García Crespo over 11 years ago
Try to run the following git command from the git bare repository:
git remote prune origin
That should do the trick. If so, we could add a note in the docs.
Updated by Alexei Kornienko over 11 years ago
No.. this won't help.
Problem is that redmine caches revisions for later use.
So a revision may be deleted in git but it is still cached in redmine.
From my point of view the right solution would be to read git refs to find existing branches and only show commits that are in branch history (the same way as git builds repository history).
Basically right now git repository must be setup on the same server with redmine. It means that in 90% of the cases we don't need redmine revision cache at all since reading from Git directly should be fast enough (caching is needed for remote SVN repository for example).
So another solution would be to disable revision cache for git
Updated by Dietmar H over 10 years ago
Pierre-Luc Samuel wrote:
I don't know if redmine uses git fetch, but a git fetch cmd would use "--prune" to remove branches that were deleted in the repository. Of course, if redmine keeps a cache of the repo, that won't clean it's internal cache...
I just had the same issue, for me adding --prune to the fetch command solved it (Redmine 2.4.1).