djl/vcprompt

If %s is specified in the format, strange output is given

Closed this issue · 6 comments

On Mac OS X 10.6 with stock python (2.6.1):

e.g.:

$ vcprompt --format "%s:%b" # In a non-versioned folder, with format
[m:"
$ vcprompt --format "%s:%b" # In a versioned folder, with format
[m:"git:master
$ vcprompt # In a versioned folder, without format
git:master
djl commented

I've been running with %s in my prompt format since the formatting arguments were added and have never come across this.

A few quick tests with the stock Snow Leopard Python don't seem to show this bug.

Could you post your full prompt and which shell you're using?

I am using ZSH and I get that output when running the command directly in the shell as well as in my prompt (so it is not specifically prompt related).

I do NOT get this in Bash, however...

djl commented

I'm willing to bet that this is a conflict with a ZSH option.

Do you have your zshrc (or other config files) available anywhere? I'll try them out and see if I can recreate the bug.

Well I only switched to ZSH yesterday so I don't really have any options other than the ones in http://github.com/robbyrussell/oh-my-zsh. If you just install that and run a zsh shell you should have the same setup as me.

In any case you are right about it being some option:

$ misc/vcprompt.py -f '%s'
git
$ source zsh/zshrc
$ misc/vcprompt.py -f '%s'
[m'git

What is strange is that running vcprompt without specifying a format, it outputs the SCM system without the strange output -- even with ZSH and all the configuration files loaded.

djl commented

Found the problem :)

It lies in oh-my-zsh's lib/termsupport.zsh. Removing this line fixes the problem.

This isn't unique to vcprompt. It seems oh-my-zsh clobbers all %s strings:

$ echo '%s'
[m'%s

very odd...

I'll log a bug with oh-my-zsh then!