Recipe default branch selection #394

Closed
opened 2023-01-27 12:52:23 +00:00 by moritz · 3 comments
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 (deleted) project 2023-06-08 09:29:52 +00:00
decentral1se removed this from the (deleted) project 2024-06-19 17:07:08 +00:00
Owner
https://git.coopcloud.tech/toolshed/abra/pulls/453#issuecomment-22259
decentral1se added this to the abra v0.10.0 project 2025-01-04 09:28:04 +00:00
Owner

Sadly, this is still a shitshow but the current state of play:

  • Git doesn't even know what Git is doing toolshed/abra#453 (comment)
  • We have a plan to support arbitrary branch names for recipes in toolshed/abra#468 aka TYPE=<recipe>:<branch>
  • NEW: abra will prefer main over master now due to a majority of our recipes supporting main and also abra init's recipes with main (will be added to the migration notes)

Let's continue on toolshed/abra#468

Sadly, this is still a shitshow but the current state of play: * Git doesn't even know what Git is doing https://git.coopcloud.tech/toolshed/abra/pulls/453#issuecomment-22259 * We have a plan to support arbitrary branch names for recipes in https://git.coopcloud.tech/toolshed/abra/issues/468 aka `TYPE=<recipe>:<branch>` * **NEW**: `abra` will prefer `main` over `master` now due to a majority of our recipes supporting `main` and also `abra` init's recipes with `main` (will be added to the migration notes) Let's continue on https://git.coopcloud.tech/toolshed/abra/issues/468
decentral1se moved this to Done in abra v0.10.0 on 2025-04-14 22:00:59 +00:00
decentral1se moved this to Done in abra v0.10.0 on 2025-04-14 22:01:01 +00:00
decentral1se moved this to Done in abra v0.10.0 on 2025-04-16 05:16:08 +00:00
decentral1se moved this to Done in abra v0.10.0 on 2025-04-16 05:16:10 +00:00
decentral1se moved this to Done in abra v0.10.0 on 2025-04-19 07:28:29 +00:00
decentral1se moved this to Done in abra v0.10.0 on 2025-04-21 17:48:16 +00:00
Sign in to join this conversation.
No description provided.