In checkout::branch (the gcb function), a reverse sort is applied to the branches, so the current HEAD (starting with an asterisk) becomes the first and is used as a header in fzf. But the relative order between the space and the asterisk can change depending on the locale configuration. This can break gcb since an unexpected branch is fixed as a header and can't be selected.
Example
Using LC_COLLATE="es_ES.UTF-8" triggers the described issue. As the image shows, main isn't the current branch, but it ended up being the header line and can't be selected. Meanwhile, the current HEAD erroneously appears in the list of branches.
Check list
Environment info
Problem / Steps to reproduce
In checkout::branch (the gcb function), a reverse sort is applied to the branches, so the current HEAD (starting with an asterisk) becomes the first and is used as a header in fzf. But the relative order between the space and the asterisk can change depending on the locale configuration. This can break gcb since an unexpected branch is fixed as a header and can't be selected.
Example
Using
LC_COLLATE="es_ES.UTF-8"
triggers the described issue. As the image shows, main isn't the current branch, but it ended up being the header line and can't be selected. Meanwhile, the current HEAD erroneously appears in the list of branches.