How to reinit "Latest revisions" (changesets) for repository
In our Redmine installation we have a few repos for which the "Latest revision" Table is not present any more. I don't know, how this happened, but I guess it was after a few git rebases or so.
The old revisions are still present via 'All revision', but newer commits are not added.
In one example, in the source code table I can see that the last commit was 3 months ago. Watching all revisions the newest entry is from 03.04.2019.
It is no general issue, all in all it works great with hundreds of repositories, only a few.
My question is the following: How can I delete and safely re-init all "Changeset" entries of a repository? I think the Changeset model represents the commits, correct?
Thanks for hints or code snippets!!
Sorry for bumping, but does really noone have an idea how to achieve the reinit of the revision history?
Okay, I just figured out the core problem:
Somehow you can get the
to include invalid/removed git revision (I could not manually reproduce it yet, but I guess by rebasing/force-pushing stuff).
Thus, the repo.fetch_changesets results in smth like that:
fatal: bad object 7b9844049e85f54df3ccd8e7e6bf4934cfce412c git log error: git exited with non-zero status: 128
repo.extra_info['heads'] =  repo.save repo.fetch_changesets
will repair this. Probably this would be worth filing an issue.