PR: Mirror Branch Filter for Forgejo
I use a private Forgejo instance to host all my projects, mirroring some to codeberg.org.
However, I’d like to be able to only publish my main
branch for each repo to Codeberg. Forgejo doesn’t support this, so I created a Feature Request. Now that I’ve fininished the update to git-next that I had been working on, I’ve made a stab at implementing this.
Forgejo is written in Go which I’ve only used very briefly about 5 years ago.
The Pull Request.
It’s not complete, but I think it hits the main points needed for the implementation.
It is missing things, like tests and documentation.
Hopefully I can get some feedback to make sure I’m even approaching the problem correctly.
Mirror Branch Filtering
A new feature to allow filtering which branches get mirrored. The changes span multiple components:
- Added
BranchFilter
field to mirror settings and API models - Updated database schema with migration
- Modified push mirror logic to handle branch filtering
- Added UI controls in repository settings
- When branch filter is specified, mirrors will only push the listed branches (comma-separated)
The mirror branch filtering provides more granular control over repository mirroring operations.