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:
parent
07d58cab9e
commit
03bea7ced4
|
@ -553,13 +553,22 @@ define-command -params 1.. \
|
||||||
cursor_line=$3
|
cursor_line=$3
|
||||||
cursor_column=$4
|
cursor_column=$4
|
||||||
blame_info=$(git blame --porcelain "$starting_commit" -L"$cursor_line,$cursor_line" -- "$file")
|
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 {
|
} else {
|
||||||
set --
|
set --
|
||||||
eval "$prepare_git_blame_args"
|
eval "$prepare_git_blame_args"
|
||||||
blame_info=$(git blame --porcelain -L"$cursor_line,$cursor_line" "$@" <${contents_fifo})
|
blame_info=$(git blame --porcelain -L"$cursor_line,$cursor_line" "$@" <${contents_fifo})
|
||||||
|
status=$?
|
||||||
if [ "$contents_fifo" != /dev/null ]; then
|
if [ "$contents_fifo" != /dev/null ]; then
|
||||||
rm -r $(dirname $contents_fifo)
|
rm -r $(dirname $contents_fifo)
|
||||||
fi
|
fi
|
||||||
|
if [ $status -ne 0 ]; then
|
||||||
|
echo 'echo -markup %{{Error}failed to run git blame, see *debug* buffer}'
|
||||||
|
exit
|
||||||
|
fi
|
||||||
} fi
|
} fi
|
||||||
eval "$(printf '%s\n---\n%s' "$blame_index" "$blame_info" |
|
eval "$(printf '%s\n---\n%s' "$blame_index" "$blame_info" |
|
||||||
client=${kak_opt_docsclient:-$kak_client} \
|
client=${kak_opt_docsclient:-$kak_client} \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user