zsh:glog: Rename $out to $hash

This commit is contained in:
2025-05-23 16:44:24 +02:00
parent bbc6d5c9e0
commit 339ef90db0

View File

@@ -51,12 +51,12 @@ local date="$dateshort %T %z" # year time timezone
local -A fzf_preview local -A fzf_preview
read -r -d '' <<EOT read -r -d '' <<EOT
out="\$(echo -E {} | sed -E "$commit_hash")"; [[ -z "\$out" ]] || hash="\$(echo -E {} | sed -E "$commit_hash")"; [[ -z "\$hash" ]] ||
EOT EOT
fzf_preview[construct]="$REPLY" fzf_preview[construct]="$REPLY"
read -r -d '' <<EOT read -r -d '' <<EOT
git show "$format" "$date" --color=always --patch-with-stat "\$out" git show "$format" "$date" --color=always --patch-with-stat "\$hash"
EOT EOT
fzf_preview[patch]="$fzf_preview[construct] { $REPLY" fzf_preview[patch]="$fzf_preview[construct] { $REPLY"
# Get file arguments after (and including) `--` and wrap each in quotes # Get file arguments after (and including) `--` and wrap each in quotes
@@ -75,13 +75,13 @@ fzf_preview[patch]+="${pager:+ | }$pager; }"
fzf_preview[files_only]+="${pager:+ | }$pager; }" fzf_preview[files_only]+="${pager:+ | }$pager; }"
read -r -d '' <<EOT read -r -d '' <<EOT
git show "$format" "$date" --color=always --stat "\$out" git show "$format" "$date" --color=always --stat "\$hash"
EOT EOT
fzf_preview[stat]="$fzf_preview[construct] { $REPLY; }" fzf_preview[stat]="$fzf_preview[construct] { $REPLY; }"
# Put the commit hash into the clipboard # Put the commit hash into the clipboard
# (If no known clipboard tool is available, just print it) # (If no known clipboard tool is available, just print it)
local fzf_copy_command="$fzf_preview[construct] echo -n \"\$out\"" local fzf_copy_command="$fzf_preview[construct] echo -n \"\$hash\""
if [[ $OSTYPE =~ darwin ]] && (( $+commands[pbcopy] )); then if [[ $OSTYPE =~ darwin ]] && (( $+commands[pbcopy] )); then
fzf_copy_command+=" | pbcopy" fzf_copy_command+=" | pbcopy"
elif (( $+commands[xclip] )); then elif (( $+commands[xclip] )); then