wfxr / forgit

:zzz: A utility tool powered by fzf for using git interactively.
MIT License
4.33k stars 136 forks source link

Collation problem in gcb #195

Closed pablombg closed 2 years ago

pablombg commented 2 years ago

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

2022-04-05_17-57

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.