From c08c39c29f93d6d46d9861901593c25634a022ba Mon Sep 17 00:00:00 2001 From: Arnaud Thimel Date: Thu, 25 Feb 2016 16:50:51 +0100 Subject: [PATCH] fix(plugins/git-prompt): Fix accentued branch names support --- plugins/git-prompt/gitstatus.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/git-prompt/gitstatus.py b/plugins/git-prompt/gitstatus.py index 3125d352..4b7abf17 100644 --- a/plugins/git-prompt/gitstatus.py +++ b/plugins/git-prompt/gitstatus.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: UTF-8 -*- from __future__ import print_function import sys @@ -50,7 +51,10 @@ if po.returncode != 0: # collect git status information untracked, staged, changed, conflicts = [], [], [], [] ahead, behind = 0, 0 -status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()] +# Remove « .decode('utf-8') » because it breaks status line if an accent (e.g.: « é ») is present. +# For example, with .decode('utf-8'), git-prompt does not display with this kind of branch name: « feature/8113_liens_supplémentaires » +# was: « status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()] » +status = [(line[0], line[1], line[2:]) for line in stdout.splitlines()] for st in status: if st[0] == '#' and st[1] == '#': if re.search('Initial commit on', st[2]):