From 7f494f0293fbdd4448d71034a642b2a5ab35fe9a Mon Sep 17 00:00:00 2001 From: weby-homelab Date: Thu, 4 Jun 2026 13:27:38 +0300 Subject: [PATCH] fix(statusline): fall back to local git query when vcs.branch is empty --- examples/statusline/statusline.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/examples/statusline/statusline.sh b/examples/statusline/statusline.sh index 390fea1ee..6026ce464 100755 --- a/examples/statusline/statusline.sh +++ b/examples/statusline/statusline.sh @@ -72,6 +72,20 @@ case "$STATE" in esac # ─── VCS Branch ────────────────────────────────────────────────────────────── +# Fallback to local git query if VCS_BRANCH is not provided in the JSON payload +if [ -z "$VCS_BRANCH" ]; then + if git rev-parse --is-inside-work-tree &>/dev/null; then + VCS_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "") + if [ -n "$VCS_BRANCH" ]; then + if git status --porcelain 2>/dev/null | grep -q .; then + VCS_DIRTY="true" + else + VCS_DIRTY="false" + fi + fi + fi +fi + V="" if [ -n "$VCS_BRANCH" ]; then if [ "$VCS_DIRTY" = "true" ]; then