Defect #9897

Git: revisions and branches deleted in Git repository are shown in redmine

Added by Alexei Kornienko almost 6 years ago. Updated over 3 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:SCM
Target version:-
Resolution: Affected version:1.3.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 :(


Related issues

Related to Redmine - Feature #1273: Need a way to re-sync repository history New 2008-05-21

History

#1 Updated by Slawomir CALUCH almost 6 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.

#2 Updated by Pierre-Luc Samuel almost 6 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...

#3 Updated by Rafael Ascensao over 5 years ago

Also have this problem. Had do delete and re-add to fix.

#4 Updated by Jesús García Crespo almost 5 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.

#5 Updated by Alexei Kornienko almost 5 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

#6 Updated by Dietmar H over 3 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).

Also available in: Atom PDF