mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-09-27 18:01:30 +02:00
Fixed a long standing bug related to international characters.
This bug occurred because whenever the "git blame" command detects international character it outputs a string escaped character string in the form "\ddd\ddd". Gitinspector didn't properly handle this. Python offers a way to decode this using the decode function together with the "string_escape" encoding.
This commit is contained in:
parent
66915b7737
commit
0fc69ff19c
3
blame.py
3
blame.py
@ -88,7 +88,8 @@ class Blame:
|
||||
lines = ls_tree_r.readlines()
|
||||
|
||||
for i, row in enumerate(lines):
|
||||
row = row.decode("utf-8", "replace")
|
||||
row = row.decode("utf-8", "replace").strip().strip("\"").strip("'")
|
||||
row = row.decode("string_escape").strip()
|
||||
if FileDiff.is_valid_extension(row) and not filtering.set_filtered(FileDiff.get_filename(row)):
|
||||
if not missing.add(row.strip()):
|
||||
blame_string = "git blame -w {0} \"".format("-C -C -M" if hard else "") + row.strip() + "\""
|
||||
|
@ -26,6 +26,7 @@ import os
|
||||
import subprocess
|
||||
import terminal
|
||||
import textwrap
|
||||
import sys
|
||||
|
||||
class FileDiff:
|
||||
def __init__(self, string):
|
||||
@ -43,13 +44,14 @@ class FileDiff:
|
||||
|
||||
@staticmethod
|
||||
def get_extension(string):
|
||||
string = string.split("|")[0].strip().strip("{}")
|
||||
string = string.split("|")[0].strip().strip("{}").strip("\"").strip("'")
|
||||
string = string.decode("string_escape").strip()
|
||||
return os.path.splitext(string)[1][1:]
|
||||
|
||||
@staticmethod
|
||||
def get_filename(string):
|
||||
string = string.split("|")[0].strip().strip("{}")
|
||||
return string.strip()
|
||||
string = string.split("|")[0].strip().strip("{}").strip("\"").strip("'")
|
||||
return string.decode("string_escape").strip()
|
||||
|
||||
@staticmethod
|
||||
def is_valid_extension(string):
|
||||
|
Loading…
Reference in New Issue
Block a user