Fix branch checking logic #204
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "Frando/abra:fix-branch-detection"
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?
Hi,
I was playing with a local recipe (not part of the catalogue) and
abra app deploy
kept complaining with this error message:FATA[0002] failed to select default branch
, even though the repo has a regular main branch.I then went to debugging, and it turns out the
repository.Branch()
method somehow does not actually check for branch names, but instead only looks at the git config, where only remote-tracking branches are listed.See https://github.com/go-git/go-git/issues/518 for details.
The attached patch fixes this and thus allows to deploy if
main
is not configured as a remote-tracking branch.An alternative would be to display a more helpful error message if it's actually required that branches have to be configured as remote-tracking branches. Currently the error message
failed to select default branch
, while the repo clearly has amain
branch, makes it hard to see what's going on (apart from diving into Go debugging which is new for me too, haven't been doing much in Go so far).Thanks!
Frando
Thanks for diving into this! This looks legit 👍 The
go-git
API is pretty obscure, so easy to miss this one. I've run into random issues with the branch logic over time but couldn't really track it down... maybe this is it!Merged in
8458e61d17
(with amended git commit message that matches the 'ol https://www.conventionalcommits.org/en/v1.0.0/ for the change log) and added you to https://git.coopcloud.tech/coop-cloud/abra/src/branch/main/AUTHORS.md. Thanks!Pull request closed