Fix gcb sort

Use LC_ALL=C to avoid potential ordering issues related to the user's
locale configuration. Additionally, add the --stable option to ensure
that just the range defined with --key is used.
This commit is contained in:
Pablo M. Bermudo Garay 2022-04-04 21:28:43 +02:00
parent d32e3c282b
commit 4dd2ca2271
2 changed files with 2 additions and 2 deletions

View file

@ -257,7 +257,7 @@ function forgit::checkout::branch -d "git checkout branch selector" --argument-n
$FORGIT_CHECKOUT_BRANCH_FZF_OPTS
"
set cmd "git branch --color=always --all | sort -k1.1,1.1 -r"
set cmd "git branch --color=always --all | LC_ALL=C sort -k1.1,1.1 -rs"
set branch (eval "$cmd" | FZF_DEFAULT_OPTS="$opts" fzf | awk '{print $1}')
test -z "$branch" && return 1

View file

@ -235,7 +235,7 @@ forgit::checkout::branch() {
forgit::inside_work_tree || return 1
[[ $# -ne 0 ]] && { git checkout -b "$@"; return $?; }
local cmd preview opts branch
cmd="git branch --color=always --all | sort -k1.1,1.1 -r"
cmd="git branch --color=always --all | LC_ALL=C sort -k1.1,1.1 -rs"
preview="git log {1} --graph --pretty=format:'$forgit_log_format' --color=always --abbrev-commit --date=relative"
opts="
$FORGIT_FZF_DEFAULT_OPTS