check_output() in get_tagname_or_hash() returns bytes instead of str in
python3. Decode the return value to utf-8, this works in both python2
and python3.
Co-authored-by: Stimim Chen <stimim@google.com>
Use add-zsh-hook to add functions to hooks. That way they won't be added again
when doing `source ~/.zshrc` multiple times.
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
The previous version modified the whole environment leading to
problems (see #7757). This version *adds* LANG=C to the current
env, without overriding it completely.
Fixes#7757.
When a commit has multiple tags associated to it, the git-prompt will
throw the following error:
git_super_status:[:4: integer expression expected: v0.21.x\ntags/v0.21.5,
git_super_status:[:7: integer expression expected: origin/v0.21.x,
git_super_status:[:11: integer expression expected: origin/v0.21.x,
git_super_status:[:14: integer expression expected: v0.21.x
git_super_status:[:23: integer expression expected: v0.21.x
This is due to the prompt expecting the tag field to be a single word
with no spaces in between but if there are multiple tags the python
script returns a string with ', ' space separated list of tags.
This throws off the parser. The solution is to ensure that the python
script returns a space-less string ensuring the git-prompt parser to
properly parse the data.
Signed-off-by: Thanh Ha <zxiiro@linux.com>
Inside a fresh git repo, i.e. immediately after a `git init`, usually no
commit template exists yet. In this case, git renders a different
status message than "Initial commit on". We should consider this message
when attempting to parse out the branch name.
Fixes#6301