Recipe default branch selection #394

Open
opened 2023-01-27 12:52:23 +00:00 by moritz · 1 comment
Member

I run into trouble while upgrading https://git.coopcloud.tech/coop-cloud/onlyoffice because this repo has two branches main and master, but it's default is main. The function GetDefaultBranch prefers master over main.

There should be either a better way to find out wich is really the default branch or the selection preference should be at least documented anywhere.

My fix was to remove the old master branch and delete the local directory.

I run into trouble while upgrading https://git.coopcloud.tech/coop-cloud/onlyoffice because this repo has two branches `main` and `master`, but it's default is `main`. The function `GetDefaultBranch` prefers `master` over `main`. There should be either a better way to find out wich is really the default branch or the selection preference should be at least documented anywhere. My fix was to remove the old master branch and delete the local directory.
moritz added the
bug
label 2023-01-27 12:52:23 +00:00
Owner

@moritz

FYI I did run in to a bug in that code again in coop-cloud/abra#261 and pushed a new fix based on various go-git chaotic API surface compromises... hopefully still working now 🤞

Yeh, the default branch choice stuff, it's actually loaded into the RecipeMeta which reads from the repository settings and gets the default branch. The only thing is that reading that and passing it down the stack for more low-level git repository operations has proved awkward.

A refactor could be to do some single repository query or caching to get the default branch from the gitea API and then attach that to the Recipe struct itself? Then it's always available? But then not ideal for this offline scenario...

This could definitely be improved, yeh.

@moritz FYI I did run in to a bug in that code again in https://git.coopcloud.tech/coop-cloud/abra/pulls/261 and pushed a new fix based on various `go-git` chaotic API surface compromises... hopefully still working now 🤞 Yeh, the default branch choice stuff, it's actually loaded into the `RecipeMeta` which reads from the repository settings and gets the default branch. The only thing is that reading that and passing it down the stack for more low-level git repository operations has proved awkward. A refactor could be to do some single repository query or caching to get the default branch from the gitea API and then attach that to the `Recipe` struct itself? Then it's always available? But then not ideal for this offline scenario... This could definitely be improved, yeh.
decentral1se added the
abra
label 2023-06-08 09:19:21 +00:00
decentral1se added this to the Critical fixes project 2023-06-08 09:29:52 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: coop-cloud/organising#394
No description provided.