fix: use short arguments for sort command

Keep it compatible to Busybox's sort implementation.
This commit is contained in:
Hoang Nguyen 2024-02-06 00:00:00 +07:00
parent 63fd2ba998
commit aa027a2e58
No known key found for this signature in database
GPG key ID: B0567C20730E9B11

View file

@ -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"