1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-01 16:32:54 +03:00

rc git: report error if blame-jump fails

git blame typically fails when the buffile is not tracked by Git.
Let's escalate the failure early instead of continuing witout blame
data, only to eventually hit the generic
"git blame-jump: missing blame info" error.
This commit is contained in:
Johannes Altmanninger 2024-02-25 17:51:12 +01:00 committed by Maxime Coste
parent 07d58cab9e
commit 03bea7ced4

View File

@ -553,13 +553,22 @@ define-command -params 1.. \
cursor_line=$3
cursor_column=$4
blame_info=$(git blame --porcelain "$starting_commit" -L"$cursor_line,$cursor_line" -- "$file")
if [ $? -ne 0 ]; then
echo 'echo -markup %{{Error}failed to run git blame, see *debug* buffer}'
exit
fi
} else {
set --
eval "$prepare_git_blame_args"
blame_info=$(git blame --porcelain -L"$cursor_line,$cursor_line" "$@" <${contents_fifo})
status=$?
if [ "$contents_fifo" != /dev/null ]; then
rm -r $(dirname $contents_fifo)
fi
if [ $status -ne 0 ]; then
echo 'echo -markup %{{Error}failed to run git blame, see *debug* buffer}'
exit
fi
} fi
eval "$(printf '%s\n---\n%s' "$blame_index" "$blame_info" |
client=${kak_opt_docsclient:-$kak_client} \