Closed tommyknows closed 1 year ago
Good catch, and thanks for the fix!
To be honest, I don't use git worktrees at all, so I'm looking to contributors for input on how exactly it should function. If there's a way to support the original use case and yours as well, especially in a more bobthefishy way, I'm open to suggestions :)
Not sure, I've got a working version that enables my use-case, but it's probably super brittle in all other use-cases 😄
I might spend some more time on the weekend to check if it can be generalised...
A refactor changed this block from a
set git_dir $PWD
toset git_dir $real_pwd
, but asreal_pwd
is a "static" variable and not dynamically computed, this breaks within thepushd
/popd
flow.Instead of using
$real_pwd
, we need to compute the current directory by calling__bobthefish_pwd
again.Fixes #249.
btw, I'm not 100% certain about this worktree-support anyways. For me, it doesn't "work", or rather, I'm using worktrees but the normal git-prompt works fine.
My use-case is different from what was described in the original issue for worktrees, and have the following directory structure:
but the
.git
repo is intmp/repo/main/.git
.So my current git-prompts look like this:
Meaning the branch is shown twice, once in the git-info and once in the path, while I have no idea in what project I'm in :)
In my case, I'd rather have the left part of the prompt show me the project, with the "branch directory" trimmed away, as that's show in the git-info already.
I don't think there's a generic solution to how people use worktrees, at least I can't see a common theme between #29 and my use-case, so I might have a look at making this functionality customisable somehow, although I'm not quite sure yet how to do that :)
Thanks a lot for this great theme & prompt!