fix: derive prompt author from git config instead of log to handle empty emails

This commit is contained in:
Janik von Rotz committed 2026-10-06 17:54:32 +02:00
1 parent b31c7dd976
commit 3728486dd1
1 file changed
+11 -3
+11 -3
View File
@@ -12,11 +12,19 @@ create-prompt() {
local repo_path="${2:-.}"
local prompt_file="$repo_path/prompt.md"
local git_author
git_author="$(git log --format="%an <%ae>" -1 2>/dev/null || echo '')"
local git_author git_email
git_author="$(git config --get user.name 2>/dev/null || echo '')"
git_email="$(git config --get user.email 2>/dev/null || echo '')"
export PROMPT_TITLE="$title"
export PROMPT_AUTHOR="${git_author:-}"
local prompt_author
if [[ -n "$git_email" ]]; then
prompt_author="${git_author} <${git_email}>"
else
prompt_author="$git_author"
fi
export PROMPT_AUTHOR="$prompt_author"
envsubst < "$HOME/taskfile.build/prompt.md.template" > "$prompt_file"