Skip to content

Commit 7425d1c

Browse files
committed
workaround gitstatusd bug in worktree tag
actual fix to upstream: change git_repository_path to git_repository_commondir on lines 154 and 178 of src/tag_db.cc I wanted to switch to this fork, since it seems like gitstatusd is dead :rip:, but it didn't work for me out of the box: https://github.com/quantumnic/powerlevel10k
1 parent 08e16b9 commit 7425d1c

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

zsh/.p10k.zsh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,17 @@
354354
res+="${meta}#"
355355
where=${(V)VCS_STATUS_TAG}
356356
else
357-
res+="${meta}@"
358-
where=${VCS_STATUS_COMMIT[1,8]}
357+
# gitstatusd can't resolve tags in git worktrees (reads from worktree
358+
# gitdir instead of commondir). Fall back to git describe.
359+
local _tag
360+
_tag=$(git describe --tags --exact-match HEAD 2>/dev/null)
361+
if [[ -n $_tag ]]; then
362+
res+="${meta}#"
363+
where=${(V)_tag}
364+
else
365+
res+="${meta}@"
366+
where=${VCS_STATUS_COMMIT[1,8]}
367+
fi
359368
fi
360369

361370
# perform substitution if the user has enabled it

0 commit comments

Comments
 (0)