From d32e3c282bdf71420fc4588a7defb2ef79847187 Mon Sep 17 00:00:00 2001 From: "Pablo M. Bermudo Garay" Date: Mon, 4 Apr 2022 21:01:59 +0200 Subject: [PATCH 1/2] Fix gcb verbose output Delete the verbose option of git checkout, so just the branch names are displayed. --- conf.d/forgit.plugin.fish | 2 +- forgit.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf.d/forgit.plugin.fish b/conf.d/forgit.plugin.fish index 53a1b29..9d98407 100644 --- a/conf.d/forgit.plugin.fish +++ b/conf.d/forgit.plugin.fish @@ -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 --verbose --all | sort -k1.1,1.1 -r" + set cmd "git branch --color=always --all | sort -k1.1,1.1 -r" set branch (eval "$cmd" | FZF_DEFAULT_OPTS="$opts" fzf | awk '{print $1}') test -z "$branch" && return 1 diff --git a/forgit.plugin.zsh b/forgit.plugin.zsh index 8c89959..b7a093c 100755 --- a/forgit.plugin.zsh +++ b/forgit.plugin.zsh @@ -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 --verbose --all | sort -k1.1,1.1 -r" + cmd="git branch --color=always --all | sort -k1.1,1.1 -r" preview="git log {1} --graph --pretty=format:'$forgit_log_format' --color=always --abbrev-commit --date=relative" opts=" $FORGIT_FZF_DEFAULT_OPTS From 4dd2ca22719003ef63cd22c846e057c0d1575a18 Mon Sep 17 00:00:00 2001 From: "Pablo M. Bermudo Garay" Date: Mon, 4 Apr 2022 21:28:43 +0200 Subject: [PATCH 2/2] 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. --- conf.d/forgit.plugin.fish | 2 +- forgit.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf.d/forgit.plugin.fish b/conf.d/forgit.plugin.fish index 9d98407..e79bdfd 100644 --- a/conf.d/forgit.plugin.fish +++ b/conf.d/forgit.plugin.fish @@ -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 diff --git a/forgit.plugin.zsh b/forgit.plugin.zsh index b7a093c..5442c82 100755 --- a/forgit.plugin.zsh +++ b/forgit.plugin.zsh @@ -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