summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2024-02-25 17:51:12 +0100
committerMaxime Coste <mawww@kakoune.org>2024-02-26 19:08:58 +1100
commit03bea7ced428beeda72186eecc50f9a8ce6f4f2b (patch)
tree6fa8ee2fc33c0c8b4b9ae9bc548e78654b867a28
parent07d58cab9ee25a80c33cd01a89f79429076c58f6 (diff)
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.
-rw-r--r--rc/tools/git.kak9
1 files changed, 9 insertions, 0 deletions
diff --git a/rc/tools/git.kak b/rc/tools/git.kak
index 2c29ee17..8c6808fa 100644
--- a/rc/tools/git.kak
+++ b/rc/tools/git.kak
@@ -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} \