From 42c8e005fece723de68d78906bb3ba7b70ff65c7 Mon Sep 17 00:00:00 2001 From: Tim <45259958+carlfriedrich@users.noreply.github.com> Date: Sat, 26 Nov 2022 13:28:25 +0100 Subject: [PATCH] glo: use forgit::diff when entering a commit (#219) When using glo (forgit log) we can press Enter to show the changeset of the selected commit. The presentation, however, was rendered using the basic git diff command. We have a much more user friendly diff command gd (forgit diff) right in forgit, though. Use this instead. --- bin/git-forgit | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/git-forgit b/bin/git-forgit index 5174548..2bc44ad 100755 --- a/bin/git-forgit +++ b/bin/git-forgit @@ -15,6 +15,9 @@ # Set shell for fzf preview commands SHELL=/bin/bash +# Get absolute forgit path +FORGIT=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)/$(basename -- "${BASH_SOURCE[0]}") + FORGIT_FZF_DEFAULT_OPTS=" $FZF_DEFAULT_OPTS --ansi @@ -69,11 +72,11 @@ _forgit_log() { local opts graph files log_format preview_cmd enter_cmd files=$(sed -nE 's/.* -- (.*)/\1/p' <<< "$*") # extract files parameters for `git show` command preview_cmd="echo {} | $_forgit_extract_sha | xargs -I% git show --color=always -U$_forgit_preview_context % -- $files | $_forgit_show_pager" - enter_cmd="echo {} | $_forgit_extract_sha | xargs -I% git show --color=always -U$_forgit_fullscreen_context % -- $files | $_forgit_show_pager" + 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 | $_forgit_enter_pager)\" + --bind=\"enter:execute($enter_cmd)\" --bind=\"ctrl-y:execute-silent(echo {} | $_forgit_extract_sha | ${FORGIT_COPY_CMD:-pbcopy})\" --preview=\"$preview_cmd\" $FORGIT_LOG_FZF_OPTS