Skip to content

Commit

Permalink
Remove deferred execution for enter command in _forgit_log
Browse files Browse the repository at this point in the history
  • Loading branch information
carlfriedrich committed Nov 4, 2023
1 parent 590029a commit c299aaa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bin/git-forgit
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,21 @@ _forgit_log_preview() {
echo "$sha" | xargs -I% git show --color=always -U"$_forgit_preview_context" % -- "$@" | $_forgit_show_pager
}

_forgit_log_enter() {
sha=$(echo "$1" | _forgit_extract_sha)
shift
echo "$sha" | xargs -I% "${FORGIT}" diff %^! "$@"
}

# git commit viewer
_forgit_log() {
_forgit_inside_work_tree || return 1
local opts graph files log_format enter_cmd
files=$(sed -nE 's/.*-- (.*)/\1/p' <<< "$*") # extract files parameters for `git show` command
enter_cmd="echo {} | $_forgit_extract_sha | xargs -I% ${FORGIT} diff %^! $files"
opts="
$FORGIT_FZF_DEFAULT_OPTS
+s +m --tiebreak=index
--bind=\"enter:execute($enter_cmd)\"
--bind=\"enter:execute($FORGIT log_enter \"{}\" $files)\"
--bind=\"ctrl-y:execute-silent($FORGIT yank_sha {})\"
--preview=\"$FORGIT log_preview \"{}\" $files\"
$FORGIT_LOG_FZF_OPTS
Expand Down Expand Up @@ -730,6 +735,7 @@ private_commands=(
"revert_preview"
"yank_sha"
"log_preview"
"log_enter"
)

cmd="$1"
Expand Down

0 comments on commit c299aaa

Please sign in to comment.