Recipe default branch selection #394
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I run into trouble while upgrading https://git.coopcloud.tech/coop-cloud/onlyoffice because this repo has two branches
main
andmaster
, but it's default ismain
. The functionGetDefaultBranch
prefersmaster
overmain
.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
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.
toolshed/abra#453 (comment)
Sadly, this is still a shitshow but the current state of play:
TYPE=<recipe>:<branch>
abra
will prefermain
overmaster
now due to a majority of our recipes supportingmain
and alsoabra
init's recipes withmain
(will be added to the migration notes)Let's continue on toolshed/abra#468