diff --git a/bin/git-forgit b/bin/git-forgit index 7b182f9..952028e 100755 --- a/bin/git-forgit +++ b/bin/git-forgit @@ -313,8 +313,10 @@ _forgit_cherry_pick() { [[ $fzf_exitval != 0 ]] && return $fzf_exitval [[ -z "$fzf_selection" ]] && return $fzf_exitval + old_IFS=$IFS IFS=$'\n' # shellcheck disable=2207 - IFS=$'\n' commits=($(echo "$fzf_selection" | sort --numeric-sort --key=1 | cut -f2 | cut -d' ' -f1 | _forgit_reverse_lines)) + commits=($(echo "$fzf_selection" | sort --numeric-sort --key=1 | cut -f2 | cut -d' ' -f1 | _forgit_reverse_lines)) + IFS=${old_IFS} [ ${#commits[@]} -eq 0 ] && return 1 $git_cherry_pick "${commits[@]}" @@ -550,13 +552,15 @@ _forgit_revert_commit() { files=$(sed -nE 's/.* -- (.*)/\1/p' <<< "$*") # extract files parameters for `git show` command preview="echo {} | cut -f2- | $_forgit_extract_sha | xargs -I% git show --color=always % -- $files | $_forgit_show_pager" + old_IFS=$IFS IFS=$'\n' # shellcheck disable=2207 - IFS=$'\n' commits=($(eval "$cmd" | + commits=($(eval "$cmd" | nl | FZF_DEFAULT_OPTS="$opts" fzf --preview="$preview" -m | sort --numeric-sort --key=1 | cut -f2- | sed 's/^[^a-f^0-9]*\([a-f0-9]*\).*/\1/')) + IFS=${old_IFS} [ ${#commits[@]} -eq 0 ] && return 1 @@ -602,9 +606,11 @@ _forgit_ignore() { --preview=\"eval $cmd\" $FORGIT_IGNORE_FZF_OPTS " + old_IFS=$IFS IFS=$'\n' # shellcheck disable=SC2206,2207 - IFS=$'\n' args=($@) && [[ $# -eq 0 ]] && args=($(_forgit_ignore_list | nl -nrn -w4 -s' ' | + args=($@) && [[ $# -eq 0 ]] && args=($(_forgit_ignore_list | nl -nrn -w4 -s' ' | FZF_DEFAULT_OPTS="$opts" fzf | awk '{print $2}')) + IFS=${old_IFS} [ ${#args[@]} -eq 0 ] && return 1 # shellcheck disable=SC2068 _forgit_ignore_get ${args[@]}