From 926a33da4dc9d65d73397b26b014fa78c3d85eb0 Mon Sep 17 00:00:00 2001 From: ptzz Date: Sat, 3 Sep 2022 02:49:18 +0200 Subject: [PATCH] Fix preview when log message contains hash-like string (#13) --- fzf-git.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fzf-git.sh b/fzf-git.sh index 5bd2335..1d900a5 100644 --- a/fzf-git.sh +++ b/fzf-git.sh @@ -177,9 +177,9 @@ _fzf_git_hashes() { --prompt '🍡 Hashes> ' \ --header $'CTRL-O (open in browser) ╱ CTRL-D (diff) ╱ CTRL-S (toggle sort)\n\n' \ --bind "ctrl-o:execute-silent:bash $__fzf_git commit {}" \ - --bind 'ctrl-d:execute:grep -o "[a-f0-9]\{7,\}" <<< {} | xargs git diff > /dev/tty' \ + --bind 'ctrl-d:execute:grep -o "[a-f0-9]\{7,\}" <<< {} | head -n 1 | xargs git diff > /dev/tty' \ --color hl:underline,hl+:underline \ - --preview 'grep -o "[a-f0-9]\{7,\}" <<< {} | xargs git show --color=always' "$@" | + --preview 'grep -o "[a-f0-9]\{7,\}" <<< {} | head -n 1 | xargs git show --color=always' "$@" | grep -o "[a-f0-9]\{7,\}" }