Possible to use the git segment with a detached worktree? #6225
Replies: 6 comments 2 replies
-
I've been reading more about the template capabilities. While I can see the potential of evaluating the conditional based on a data structure provided via Thinking this won't be possible but will leave this open for a few days on the off-chance someone has an idea. |
Beta Was this translation helpful? Give feedback.
-
@windowsrefund this is not supported. There's always the need for a .git folder or file, as oh-my-posh is folder based for context. This use-case is very exotic git usage (I haven't come across this use case in my 13 years of doing this), and I don't see how it can be supported besides exposing those API's (which makes everything else super challenging). My proposal, make use of the function hook we provide and add the context you need in an environment variable. |
Beta Was this translation helpful? Give feedback.
-
I appreciate the guidance and will dig into your suggestion. |
Beta Was this translation helpful? Give feedback.
-
Have been giving this some additional thought and seeing no real potential for a win with the In order to start verifying this theory, I just went ahead and set the alias globally.
So far, my theory seems entirely reasonable. However, my debug messages show me the args passed by the segment aren't being appended. Instead, they're clobbering and this confuses me.
Aside from my curiosity related to how the args are being passed to the Thanks in advance |
Beta Was this translation helpful? Give feedback.
-
Fair enough. Just to be clear, you don't see potential to add support for overriding args passed to the In addition to the above idea, I also tried using the |
Beta Was this translation helpful? Give feedback.
-
Interesting. I'll be happy to help test. Thanks again for the feedback. |
Beta Was this translation helpful? Give feedback.
-
By detached, I mean the associated bare repo resides elsewhere. A common use-case for this pattern comes up when managing dotfiles as outlined here.
TL;DR This workflow leans into creating a wrapper function around (for example)
git --git-dir="$DOTFILES" --work-tree="$HOME" "$@"
I've been reading the docs on the git segment and while I see the support for worktrees, I don't see any evidence things are designed to work when the bare repo resides elsewhere on the filesystem. Hopefully I'm just overlooking something obvious?
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions