posh-git prompt/latest version slowness

33 views
Skip to first unread message

Keith Dahlby

unread,
Mar 13, 2010, 10:06:16 AM3/13/10
to posh...@googlegroups.com
Yeah, I'm not sure if there's a clean way to allow multiple tab expansion extensions. Could maybe add a lookup table of sorts where you can add patterns to match and the expansion function to execute, falling through to the default if nothing matches? I can't imagine we're the first to run into this...

Completion for sub-commands would be slick... And stash IDs for apply/pop/drop too.



On Fri, Mar 12, 2010 at 10:15 AM, Mark Embling <con...@markembling.info> wrote:
Hmm, sounds like a few things worth checking out. I agree regarding the git status call, but in practice (even with a fair few changes) it seems to run pretty fast. Would be well worth trying to see if there's a better way though.

Yeah, I initially liked the DefaultTabExpansion stuff but had to delete it because it was causing problems where I was also defining another TabExpansion method inside my profile for dealing with other non-git-related things. It was just replacing the git version and stopping it working. Not sure if there's a better way of doing this - ideally I'd like the ability to plug in as many as needed but so far the only way I've got of doing that is to define the TabExpansion method inside my profile and put all choices in there. Perhaps its worth me sticking the DefaultTabExpansion stuff back in there to avoid the issues you mention though? Not something I've run into yet.

Sounds good - I'm intending to cover a few other scenarios which we ignore for now. It'd be nice to have some help with git stash for instance:

git stas<tab> -> git stash
git stash ap<tab> -> git stash apply

I'm sure there are others too. I think its coming together pretty well though. :)

Mark



On Fri, Mar 12, 2010 at 16:05, Keith Dahlby <dah...@gmail.com> wrote:
Sorry to hear about your problems. I have 1.7 at home, but it was a clean install - thanks for the warning.

I would bet the slowest call is the git-status, which is now only being used to check how far ahead we are - I'm sure we can find a better way to get that info (git-cherry?), as we don't need the rest of the information status is giving us. We might also be able to take advantage of git-ls-files, which seems to be to be faster than diff-files and diff-index. Also, we can probably get a few tips from zsh-git, which is what I believe msysGit Bash uses: http://github.com/jcorbin/zsh-git

I did check out your fork and I like most of the changes. The DefaultTabExpansion stuff that you had deleted was to fix a few places where completion stopped working - variable names, for example.

Over the weekend I'm planning to look at adding merge/rebase detection, as the prompt fails pretty hard if things aren't just right.

Cheers ~
Keith


On Fri, Mar 12, 2010 at 9:51 AM, Mark Embling <con...@markembling.info> wrote:
Haven't tried it on latest, no. We're making a lot of git calls...any idea which is the slow one?

That's the peculiar thing - I've tried running each one in isolation and they all seem pretty fast. I've managed to speed it up a tad by reducing the amount of times we check for whether we're inside a git repo (Test-GitDirectory), but in my opinion it's still slow to the point of being a pain (on my machine/environment at least). Will try on a different machine later/tomorrow to make sure it isn't just something on here.

I'm hoping it's not something I've managed to introduce (I've modified it a bit since forking yours), so am keen to see if it does the same thing for you and/or in different environments. Going to look into it more later/tomorrow.

If you're interested in my version, feel free to check it out on github. I've branched for my attempts to fix things for git 1.7 in a branch called git1.7. Recently I added the ability for it to include all commands (rather than just the common ones) as an opt-in option for command completion - however 1.7 seems to have decided to do things differently so that'll be something I'll also need to look at.

So far, this "upgrade" has proved to be less than hassle-free. Its also obliterated my difftool settings without warning, so be aware of that when you upgrade in case it does the same for you. On the plus side, if you work in a domain environment and have a domain user account and a local user account with the same name, it now seems to use the correct home directory for ssh and .gitconfig now.

Mark




Keith Dahlby

unread,
Mar 14, 2010, 9:50:58 PM3/14/10
to posh-git
Seems someone implemented git support to PowerTab a while back too,
may be worth a look.
http://techblogging.wordpress.com/2008/10/13/context-sensitive-auto-completion-using-powershell-powertab-and-git/

I checked how PowerTab handles registering new tab handlers but I'm
not sure there's much we can use - it's all based on a pretty heavy
configuration mechanism.


On Mar 13, 10:06 am, Keith Dahlby <dahl...@gmail.com> wrote:
> Yeah, I'm not sure if there's a clean way to allow multiple tab expansion
> extensions. Could maybe add a lookup table of sorts where you can add
> patterns to match and the expansion function to execute, falling through to
> the default if nothing matches? I can't imagine we're the first to run into
> this...
>
> Completion for sub-commands would be slick... And stash IDs for
> apply/pop/drop too.
>

> On Fri, Mar 12, 2010 at 10:15 AM, Mark Embling <cont...@markembling.info>wrote:
>
> > Hmm, sounds like a few things worth checking out. I agree regarding the git
> > status call, but in practice (even with a fair few changes) it seems to run
> > pretty fast. Would be well worth trying to see if there's a better way
> > though.
>
> > Yeah, I initially liked the DefaultTabExpansion stuff but had to delete it
> > because it was causing problems where I was also defining another
> > TabExpansion method inside my profile for dealing with other non-git-related
> > things. It was just replacing the git version and stopping it working. Not
> > sure if there's a better way of doing this - ideally I'd like the ability to
> > plug in as many as needed but so far the only way I've got of doing that is
> > to define the TabExpansion method inside my profile and put all choices in
> > there. Perhaps its worth me sticking the DefaultTabExpansion stuff back in
> > there to avoid the issues you mention though? Not something I've run into
> > yet.
>
> > Sounds good - I'm intending to cover a few other scenarios which we ignore
> > for now. It'd be nice to have some help with git stash for instance:
>

> > git stas*<tab>* -> git stash
> > git stash ap*<tab>* -> git stash apply


>
> > I'm sure there are others too. I think its coming together pretty well
> > though. :)
>
> > Mark
>

> > On Fri, Mar 12, 2010 at 16:05, Keith Dahlby <dahl...@gmail.com> wrote:
>
> >> Sorry to hear about your problems. I have 1.7 at home, but it was a clean
> >> install - thanks for the warning.
>
> >> I would bet the slowest call is the git-status, which is now only being
> >> used to check how far ahead we are - I'm sure we can find a better way to
> >> get that info (git-cherry?), as we don't need the rest of the information
> >> status is giving us. We might also be able to take advantage of
> >> git-ls-files, which seems to be to be faster than diff-files and diff-index.
> >> Also, we can probably get a few tips from zsh-git, which is what I believe
> >> msysGit Bash uses:http://github.com/jcorbin/zsh-git
>
> >> I did check out your fork and I like most of the changes. The
> >> DefaultTabExpansion stuff that you had deleted was to fix a few places where
> >> completion stopped working - variable names, for example.
>
> >> Over the weekend I'm planning to look at adding merge/rebase detection, as
> >> the prompt fails pretty hard if things aren't just right.
>
> >> Cheers ~
> >> Keith
>

Keith Dahlby

unread,
Mar 14, 2010, 9:57:42 PM3/14/10
to posh-git
Other links I've stumbled on...

http://stackoverflow.com/questions/2180270/zsh-check-if-current-directoy-is-git-repo
http://svn.haxx.se/users/archive-2006-06/att-0429/TabExpansion.ps1.txt


On Mar 14, 8:50 pm, Keith Dahlby <dahl...@gmail.com> wrote:
> Seems someone implemented git support to PowerTab a while back too,

> may be worth a look.http://techblogging.wordpress.com/2008/10/13/context-sensitive-auto-c...

Mark Embling

unread,
Mar 15, 2010, 4:45:07 AM3/15/10
to posh...@googlegroups.com
Yes, I tried doing that too but abandoned it. I hasn't too happy about how I had to delve around in a load of different places in the code. It felt like a bit of a kludge or a patch whereas the native PS completion version doesn't so much. I think you're right in that there's anything of use there - it's just a mix of hard-coded bits and calls out to git like we use in order to generate the list of branches etc.

Keith Dahlby

unread,
Mar 25, 2010, 4:26:41 AM3/25/10
to posh-git
Tagging another link for later. In particular, the __git_ps1()
function covers how to detect the various rebase/merge conditions,
BARE, etc.

http://git.kernel.org/?p=git/git.git;a=blob;f=contrib/completion/git-completion.bash;hb=HEAD


On Mar 14, 8:57 pm, Keith Dahlby <dahl...@gmail.com> wrote:
> Other links I've stumbled on...
>

> http://stackoverflow.com/questions/2180270/zsh-check-if-current-direc...http://svn.haxx.se/users/archive-2006-06/att-0429/TabExpansion.ps1.txt

Reply all
Reply to author
Forward
0 new messages