From aa027a2e58bd9d348d9357f85b812c01404639d5 Mon Sep 17 00:00:00 2001 From: Hoang Nguyen Date: Tue, 6 Feb 2024 00:00:00 +0700 Subject: [PATCH] fix: use short arguments for sort command Keep it compatible to Busybox's sort implementation. --- bin/git-forgit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/git-forgit b/bin/git-forgit index 0db33a3..abb9c61 100755 --- a/bin/git-forgit +++ b/bin/git-forgit @@ -338,7 +338,7 @@ _forgit_cherry_pick() { ${IFS+"false"} && unset old_IFS || old_IFS="$IFS" IFS=$'\n' # shellcheck disable=2207 - commits=($(echo "$fzf_selection" | sort --numeric-sort --key=1 | cut -f2 | cut -d' ' -f1 | _forgit_reverse_lines)) + commits=($(echo "$fzf_selection" | sort -n -k 1 | cut -f2 | cut -d' ' -f1 | _forgit_reverse_lines)) ${old_IFS+"false"} && unset IFS || IFS="$old_IFS" [ ${#commits[@]} -eq 0 ] && return 1 @@ -582,7 +582,7 @@ _forgit_revert_commit() { commits=($(eval "$cmd" | nl | FZF_DEFAULT_OPTS="$opts" fzf --preview="$preview" -m | - sort --numeric-sort --key=1 | + sort -n -k 1 | cut -f2- | sed 's/^[^a-f^0-9]*\([a-f0-9]*\).*/\1/')) ${old_IFS+"false"} && unset IFS || IFS="$old_IFS"