Skip to content

Commit

Permalink
Remove deferred execution in _forgit_checkout_file
Browse files Browse the repository at this point in the history
  • Loading branch information
sandr01d committed Nov 4, 2023
1 parent fdd7966 commit 5b78913
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bin/git-forgit
Original file line number Diff line number Diff line change
Expand Up @@ -458,17 +458,20 @@ _forgit_fixup() {

}

_forgit_checkout_file_preview() {
git diff --color=always -- "$1" | $_forgit_diff_pager
}

# git checkout-file selector
_forgit_checkout_file() {
_forgit_inside_work_tree || return 1
local git_checkout cmd files opts
local git_checkout files opts
git_checkout="git checkout $FORGIT_CHECKOUT_FILE_GIT_OPTS"
[[ $# -ne 0 ]] && { $git_checkout -- "$@"; return $?; }
cmd="git diff --color=always -- {} | $_forgit_diff_pager"
opts="
$FORGIT_FZF_DEFAULT_OPTS
-m -0
--preview=\"$cmd\"
--preview=\"$FORGIT checkout_file_preview {}\"
$FORGIT_CHECKOUT_FILE_FZF_OPTS
"
files="$(git ls-files --modified "$(git rev-parse --show-toplevel)"| FZF_DEFAULT_OPTS="$opts" fzf)"
Expand Down Expand Up @@ -731,6 +734,7 @@ private_commands=(
"blame_preview"
"branch_preview"
"checkout_commit_preview"
"checkout_file_preview"
"ignore_preview"
"revert_preview"
"yank_sha"
Expand Down

0 comments on commit 5b78913

Please sign in to comment.